2 #@ Synopsis: [OBJDIR=XY] ./mx-test.sh --check mailx-binary [:SKIPTESTNAME:]
3 #@ [OBJDIR=XY] ./mx-test.sh --run-test mailx-binary [:TESTNAME:]
4 #@ [./mx-test.sh # Note: performs hundreds of compilations!]
5 #@ --no-jobs can be used to prevent spawning concurrent tests.
6 #@ --no-colour or $MAILX_CC_TEST_NO_COLOUR for not trying to use colour
7 #@ (then grep for ^ERROR, for example).
8 #@ The last mode also reacts on $MAILX_CC_ALL_TESTS_DUMPERR, for even easier
9 #@ grep ^ERROR handling.
10 #@ And setting $MAILX_CC_TEST_NO_CLEANUP keeps all test data around, fwiw:
11 #@ this works with --run-test only.
12 #@ $JOBWAIT, $JOBMON and $SKIPTEST are taken from environment when found.
18 # Instead of figuring out the environment in here, require a configured build
19 # system and include that! Our makefile and configure ensure that this test
20 # does not run in the configured, but the user environment nonetheless!
23 if [ -f .
/mk-config.env
]; then
25 elif [ -f snailmail.jpg
] && [ -f "${OBJDIR}"/mk-config.env
]; then
26 i
=`pwd`/ # not from environment, sic
30 echo >&2 'S-nail/S-mailx is not configured.'
31 echo >&2 'This test script requires the shell environment that only the'
32 echo >&2 'configuration script can figure out, even if used to test'
33 echo >&2 'a different binary than the one that would be produced!'
34 echo >&2 '(The information will be in ${OBJDIR:=.obj}/mk-config.env.)'
35 echo >&2 'Hit RETURN to run "make config"'
41 if [ -z "${MAILX__CC_TEST_RUNNING}" ]; then
42 MAILX__CC_TEST_RUNNING
=1
43 export MAILX__CC_TEST_RUNNING
44 exec "${SHELL}" "${i}${0}" "${@}"
47 # We need *stealthmua* regardless of $SOURCE_DATE_EPOCH, the program name as
48 # such is a compile-time variable
49 ARGS
='-Sv15-compat -:/ -Sdotlock-disable -Smta=test -Smta-bcc-ok'
50 ARGS
="${ARGS}"' -Smemdebug -Sstealthmua'
51 ARGS
="${ARGS}"' -Smime-encoding=quoted-printable -Snosave'
52 ARGS
="${ARGS}"' -Smailcap-disable -Smimetypes-load-control='
53 NOBATCH_ARGS
="${ARGS}"' -Sexpandaddr'
54 ARGS
="${ARGS}"' -Sexpandaddr=restrict -#'
55 ADDARG_UNI
=-Sttycharset=UTF-8
59 ERR
=.
/.cc-test.err
# Covers some which cannot be checksummed; not quoted!
61 #UTF8_LOCALE= HONOURS_READONLY= autodetected unless set
64 # When testing mass mail/loops, maximum number of receivers/loops.
65 # TODO note we do not gracefully handle ARG_MAX excess yet!
66 # Those which use this have checksums for 2001 and 201.
67 # Some use the smaller automatically if +debug
68 LOOPS_BIG
=2001 LOOPS_SMALL
=201
69 LOOPS_MAX
=$LOOPS_SMALL
71 # How long unless started tests get reaped (avoid endless looping)
76 # Note valgrind has problems with FDs in forked childs, which causes some tests
77 # to fail (the FD is rewound and thus will be dumped twice)
79 #MEMTESTER='valgrind --leak-check=full --log-file=.vl-%p '
85 jspawn X_Y_opt_input_go_stack
90 jspawn input_inject_semicolon_seq
92 jspawn commandalias
# test now, save space later on!
102 jspawn macro_param_shift
112 jspawn headerpick
# so we have a notion that it works a bit
115 # Send/RFC absolute basics
130 # MIME and RFC basics
131 jspawn mime_if_not_ascii
133 jspawn xxxheads_rfc2047
134 jspawn iconv_mbyte_base64
135 jspawn iconv_mainbody
136 jspawn mime_force_sendout
137 jspawn binary_mainbody
138 jspawn C_opt_customhdr
141 # Operational basics with trivial tests
148 # Operational basics with easy tests
149 jspawn expandaddr
# (after t_alias)
150 jspawn mta_aliases
# (after t_expandaddr)
154 jspawn message_injections
156 jspawn rfc2231
# (after attachments)
157 jspawn mime_types_load_control
160 # Around state machine, after basics
165 jspawn on_main_loop_tick
166 jspawn on_program_exit
169 # Heavy use of/rely on state machine (behaviour) and basics
171 jspawn mass_recipients
172 jspawn lreply_futh_rth_etc
186 ## Now it is getting really weird. You have been warned.
187 # Setup and support {{{
188 export ARGS ADDARG_UNI CONF BODY MBOX MAIL TMPDIR \
189 MAKE
awk cat cksum rm sed grep
193 # Wed Oct 2 01:50:07 UTC 1996
194 SOURCE_DATE_EPOCH
=844221007
196 export LC_ALL LANG TZ SOURCE_DATE_EPOCH
197 unset POSIXLY_CORRECT LOGNAME USER
202 Synopsis: [OBJDIR=x] mx-test.sh [--no-jobs] --check mailx-binary [:SKIPTEST:]
203 Synopsis: [OBJDIR=x] mx-test.sh [--no-jobs] --run-test mailx-binary [:TEST:]
204 Synopsis: [OBJDIR=x] mx-test.sh [--no-jobs]
206 --check EXE [:SKIPTEST:] run test series, exit success or error.
207 [:SKIPTEST:]s (and $SKIPTEST=) will be excluded.
208 --run-test EXE [:TEST:] run all or only the given TESTs, and create
209 test output data files; if run in a git(1)
210 checkout with the [test-out] branch available,
211 it will also create file diff(1)erences
212 --no-jobs do not spawn multiple jobs simultaneously
213 (dependent on make(1) and sh(1), pass JOBMON=n, too)
214 --no-colour or $MAILX_CC_TEST_NO_COLOUR: no colour
215 (for example to: grep ^ERROR)
216 $MAILX_CC_ALL_TESTS_DUMPER in addition for even
217 easier grep ^ERROR handling
219 The last invocation style will compile and test as many different
220 configurations as possible.
221 EXE should be absolute or relative to $OBJDIR, which can be may be set to the
222 location of the built objects etc.
223 $MAILX_CC_TEST_NO_CLEANUP skips deletion of test data (works only with
224 one test, aka --run-test).
225 $JOBWAIT could denote a timeout, $JOBMON controls usage of "set -m".
230 CHECK
= RUN_TEST
= MAILX
=
231 DEVELDIFF
= DUMPERR
= GIT_REPO
=
232 MAXJOBS
=1 NOCOLOUR
= NOJOBS
=
233 while [ ${#} -gt 0 ]; do
234 if [ "${1}" = --no-jobs ]; then
237 elif [ "${1}" = --no-colour ]; then
240 elif [ "${1}" = -h ] ||
[ "${1}" = --help ]; then
248 if [ "${1}" = --check ]; then
250 [ -x "${MAILX}" ] || usage
252 SKIPTEST
="${@} ${SKIPTEST}"
253 [ -d ..
/.git
] && [ -z "${MAILX__CC_TEST_NO_DATA_FILES}" ] && GIT_REPO
=1
254 echo 'Mode: --check, binary: '"${MAILX}"
255 elif [ "${1}" = --run-test ]; then
256 [ ${#} -ge 2 ] || usage
257 RUN_TEST
=1 MAILX
=${2}
258 [ -x "${MAILX}" ] || usage
260 [ -d ..
/.git
] && GIT_REPO
=1
261 echo 'Mode: --run-test, binary: '"${MAILX}"
263 [ ${#} -eq 0 ] || usage
264 echo 'Mode: full compile test, this will take a long time...'
265 MAILX__CC_TEST_NO_DATA_FILES
=1
266 export MAILX__CC_TEST_NO_DATA_FILES
270 # Since we invoke $MAILX from within several directories we need a fully
271 # qualified path. Or at least something similar.
272 { echo ${MAILX} | ${grep} -q ^/; } || MAILX="${TMPDIR}"/${MAILX}
274 MAILX
="${MEMTESTER}${MAILX}"
275 export RAWMAILX MAILX
277 # We want an UTF-8 locale, and HONOURS_READONLY {{{
278 if [ -n "${CHECK}${RUN_TEST}" ]; then
279 if [ -z "${UTF8_LOCALE}" ]; then
280 # Try ourselfs via nl_langinfo(CODESET) first (requires a new version)
281 if command -v "${RAWMAILX}" >/dev
/null
2>&1 &&
282 ("${RAWMAILX}" -:/ -Xxit) >/dev
/null
2>&1; then
283 echo 'Trying to detect UTF-8 locale via '"${RAWMAILX}"
284 i
=`</dev/null LC_ALL=C.utf8 "${RAWMAILX}" ${ARGS} -X '
287 \if "${ttycharset}" =%?case utf
294 \xcall cset_test "${@}"
298 \call cset_test C.UTF-8 POSIX.utf8 POSIX.UTF-8 \
299 en_EN.utf8 en_EN.UTF-8 en_US.utf8 en_US.UTF-8
301 [ $?
-eq 0 ] && UTF8_LOCALE
=$i
304 if [ -z "${UTF8_LOCALE}" ] && (locale yesexpr
) >/dev
/null
2>&1; then
305 echo 'Trying to detect UTF-8 locale via locale -a'
306 UTF8_LOCALE
=`locale -a | { m=
309 ${grep} -i -e utf8 -e utf-8; } >/dev/null 2>&1; then
312 ${grep} -e POSIX -e en_EN -e en_US; } \
313 >/dev/null 2>&1; then
323 if [ -n "${UTF8_LOCALE}" ]; then
324 echo 'Using Unicode locale '"${UTF8_LOCALE}"
326 echo 'No Unicode locale found, disabling Unicode tests'
329 if [ -z "${HONOURS_READONLY}" ]; then
330 trap "${rm} -f ./.tisrdonly" EXIT
331 trap "exit 1" HUP INT TERM
332 printf '' > .
/.tisrdonly
333 ${chmod} 0444 .
/.tisrdonly
334 if (printf 'no\n' > .
/.tisrdonly
) >/dev
/null
2>&1 &&
335 test -s .
/.tisrdonly
; then
340 ${rm} -f .
/.tisrdonly
341 trap '' EXIT HUP INT TERM
345 export UTF8_LOCALE HONOURS_READONLY
348 TESTS_PERFORMED
=0 TESTS_OK
=0 TESTS_FAILED
=0 TESTS_SKIPPED
=0
349 JOBS
=0 JOBLIST
= JOBREAPER
= JOBSYNC
=
351 ( sleep .1 ) >/dev
/null
2>&1 && SUBSECOND_SLEEP
=y
353 COLOR_ERR_ON
= COLOR_ERR_OFF
=
354 COLOR_WARN_ON
= COLOR_WARN_OFF
=
355 COLOR_OK_ON
= COLOR_OK_OFF
=
361 [ -z "${MAILX_CC_TEST_NO_CLEANUP}" ] &&
362 ${rm} -rf ./t.*.d ./t.*.io ./t.*.result ./t.time.out
364 trap "exit 1" HUP INT QUIT TERM
367 if [ -n "${NOJOBS}" ]; then
371 # The user desired variant
372 if ( echo "${MAKEFLAGS}" |
${grep} -- -j ) >/dev
/null
2>&1; then
373 i
=`echo "${MAKEFLAGS}" |
374 ${sed} -e 's/^.*-j[ ]*\([0-9]\{1,\}\).*$/\1/'`
375 if ( echo "${i}" |
grep -q -e '^[0-9]\{1,\}$' ); then
376 printf 'Job number derived from MAKEFLAGS: %s\n' ${i}
378 [ "${MAXJOBS}" -eq 0 ] && MAXJOBS
=1
383 # The actual hardware
384 printf 'all:\n' > t.mk.io
385 if ( ${MAKE} -j 10 -f t.mk.io
) >/dev
/null
2>&1; then
386 if command -v nproc
>/dev
/null
2>&1; then
387 i
=`nproc 2>/dev/null`
388 [ ${?} -eq 0 ] && MAXJOBS
=${i}
390 i
=`getconf _NPROCESSORS_ONLN 2>/dev/null`
392 if [ ${j} -ne 0 ]; then
393 i
=`getconf NPROCESSORS_ONLN 2>/dev/null`
396 if [ ${j} -ne 0 ]; then
398 if command -v kstat
>/dev
/null
2>&1; then
399 i
=`PERL5OPT= kstat -p cpu | ${awk} '
401 {if($2 > no) max = $2; next}
407 if [ ${j} -eq 0 ] && [ -n "${i}" ]; then
408 printf 'Job number derived from CPU number: %s\n' ${i}
412 [ "${MAXJOBS}" -eq 0 ] && MAXJOBS
=1
420 # There were problems when using monitor mode with mksh
421 i
=`env -i ${SHELL} -c 'echo $KSH_VERSION'`
422 if [ -n "${i}" ]; then
423 if [ "${i}" != "${i#*MIRBSD}" ]; then
428 if [ -n "${JOBMON}" ]; then
429 ( set -m ) </dev
/null
>/dev
/null
2>&1 || JOBMON
=
431 printf >&2 '%s! $JOBMON: $SHELL %s incapable, disabled!%s\n' \
432 "${COLOR_ERR_ON}" "${SHELL}" "${COLOR_ERR_OFF}"
433 printf >&2 '%s! No process groups available, killed tests may '\
434 'leave process "zombies"!%s\n' \
435 "${COLOR_ERR_ON}" "${COLOR_ERR_OFF}"
445 if [ ${JOBS} -gt 0 ]; then
446 echo 'Cleaning up running jobs'
447 [ -n "${JOBREAPER}" ] && kill -KILL ${JOBREAPER} >/dev
/null
2>&1
455 if [ -n "${CHECK}" ] && [ -n "${SKIPTEST}" ]; then
461 while [ ${#} -gt 0 ]; do
462 if [ "${1}" != "${j}" ]; then
463 SKIPTEST
="${SKIPTEST} ${1}"
464 elif [ -z "${k}" ]; then
470 [ -n "${k}" ] && return
474 if [ ${MAXJOBS} -gt 1 ]; then
475 # We are spawning multiple jobs..
476 [ ${JOBS} -eq 0 ] && printf '...'
478 printf ' [%s=%s]' ${JOBS} "${1}"
481 # Assume problems exist, do not let user keep hanging on terminal
482 if [ -n "${RUN_TEST}" ]; then
483 printf '... [%s]\n' "${1}"
487 [ -n "${JOBMON}" ] && set -m >/dev
/null
2>&1
488 ( # Place the job in its own directory to ease file management
489 trap '' EXIT HUP INT QUIT TERM USR1 USR2
490 ${mkdir} t.${JOBS}.d && cd t.${JOBS}.d
&&
491 eval t_
${1} ${JOBS} ${1} &&
492 ${rm} -f ..
/t.
${JOBS}.id
493 ) > t.
${JOBS}.io
</dev
/null
& # 2>&1 </dev/null &
495 [ -n "${JOBMON}" ] && set +m
>/dev
/null
2>&1
496 JOBLIST
="${JOBLIST} ${i}"
497 printf '%s\n%s\n' ${i} ${1} > t.${JOBS}.id
499 # ..until we should sync or reach the maximum concurrent number
500 [ ${JOBS} -lt ${MAXJOBS} ] && return
506 if [ ${JOBS} -eq 0 ]; then
507 [ -n "${TEST_ANY}" ] && printf '\n'
511 [ -z "${JOBSYNC}" ] && [ ${#} -eq 0 ] && return
513 [ ${MAXJOBS} -ne 1 ] && printf ' .. waiting\n'
515 # Start an asynchronous notify process
516 ${rm} -f .
/t.
time.out
520 trap "kill -TERM ${sleeper}; exit 1" HUP INT TERM
523 printf '' > .
/t.
time.out
524 ) </dev
/null
>/dev
/null
2>&1 &
527 # Then loop a while, looking out for collecting tests
530 [ -f .
/t.
time.out
] && break
533 while [ ${i} -lt ${JOBS} ]; do
535 [ -f t.
${i}.id
] ||
continue
539 [ -n "${alldone}" ] && break
541 if [ -z "${SUBSECOND_SLEEP}" ]; then
542 loops
=`add ${loops} 1`
543 [ ${loops} -lt 111 ] && continue
551 if [ -f .
/t.
time.out
]; then
552 ${rm} -f .
/t.
time.out
555 kill -TERM ${JOBREAPER} >/dev
/null
2>&1
560 # Now collect the zombies
564 # Update global counters
566 while [ ${i} -lt ${JOBS} ]; do
569 [ -s t.
${i}.io ] && ${cat} t.${i}.io
570 if [ -n "${DUMPERR}" ] && [ -s ./t.${i}.d/${ERR} ]; then
571 printf '%s [Debug/Devel: nullified errors]\n' "${COLOR_ERR_ON}"
573 printf ' %s\n' "${l}"
574 done < t.${i}.d/${ERR}
575 printf '%s' "${COLOR_ERR_OFF}"
578 if [ -f t.${i}.id ]; then
579 { read pid; read desc; } < t.${i}.id
580 desc=${desc#${desc%%[! ]*}}
581 desc=${desc%${desc##*[! ]}}
582 [ -s t.${i}.io ] && printf >&2 '\n'
583 printf >&2 '%s!! Timeout: reaped job %s [%s]%s\n' \
584 "${COLOR_ERR_ON}" ${i} "${desc}" "${COLOR_ERR_OFF}"
585 TESTS_FAILED=`add ${TESTS_FAILED} 1`
586 elif [ -s t.${i}.result ]; then
587 read es tp to tf ts < t.${i}.result
588 TESTS_PERFORMED=`add ${TESTS_PERFORMED} ${tp}`
589 TESTS_OK=`add ${TESTS_OK} ${to}`
590 TESTS_FAILED=`add ${TESTS_FAILED} ${tf}`
591 TESTS_SKIPPED=`add ${TESTS_SKIPPED} ${ts}`
592 [ "${es}" != 0 ] && ESTAT=${es}
594 TESTS_FAILED=`add ${TESTS_FAILED} 1`
599 [ -z "${MAILX_CC_TEST_NO_CLEANUP}" ] &&
600 ${rm} -rf ./t.*.d ./t.*.id ./t.*.io t.*.result ./t.time.out
607 while [ ${i} -lt ${JOBS} ]; do
609 if [ -f t.${i}.id ] &&
610 read pid < t.${i}.id >/dev/null 2>&1 &&
611 kill -0 ${pid} >/dev/null 2>&1; then
613 [ -n "${JOBMON}" ] && j=-${j}
614 kill -KILL ${j} >/dev/null 2>&1
622 # echoes, checks, etc. {{{
626 ESTAT=0 TESTS_PERFORMED=0 TESTS_OK=0 TESTS_FAILED=0 TESTS_SKIPPED=0 \
627 TEST_NAME=${1} TEST_ANY=
629 printf '%s[%s]%s\n' "" "${TEST_NAME}" ""
633 [ -n "${TEST_ANY}" ] && printf '\n'
635 printf '%s %s %s %s %s\n' \
637 ${TESTS_PERFORMED} ${TESTS_OK} ${TESTS_FAILED} ${TESTS_SKIPPED} \
642 [ -n "${TEST_ANY}" ] && __i__=' ' || __i__=
643 printf "${__i__}"'%s' "${*}"
648 [ -n "${TEST_ANY}" ] && __i__=' ' || __i__=
649 printf "${__i__}"'%s%s:ok%s' "${COLOR_OK_ON}" "${*}" "${COLOR_OK_OFF}"
659 [ -n "${TEST_ANY}" ] && __i__="\n" || __i__=
660 printf "${__i__}"'%sERROR: %s%s\n' \
661 "${COLOR_ERR_ON}" "${*}" "${COLOR_ERR_OFF}"
666 [ -n "${TEST_ANY}" ] && __i__=' ' || __i__=
667 printf "${__i__}"'%s%s%s' "${COLOR_WARN_ON}" "${*}" "${COLOR_WARN_OFF}"
672 [ -n "${TEST_ANY}" ] && __i__=' ' || __i__=
673 printf "${__i__}"'%s%s[skip]%s' \
674 "${COLOR_WARN_ON}" "${*}" "${COLOR_WARN_OFF}"
676 TESTS_SKIPPED=`add ${TESTS_SKIPPED} 1`
680 restat=${?} tid=${1} eestat=${2} f=${3} s=${4} optmode=${5}
682 TESTS_PERFORMED=`add ${TESTS_PERFORMED} 1`
687 [ "$eestat" = - ] || exit 200
689 [ -f "${f}" ] && break
690 t_echowarn "[${tid}:async
=wait]"
698 check__bad= check__runx=
700 if [ "${eestat}" != - ] && [ "${restat}" != "${eestat}" ]; then
702 t_echoerr "${tid}: bad-status: ${restat} != ${eestat}"
706 csum="`${cksum} < "${f}" | ${sed} -e 's/[ ]\{1,\}/ /g'`"
707 if [ "${csum}" = "${s}" ]; then
709 check__runx=${DEVELDIFF}
712 t_echoerr "${tid}: checksum mismatch
(got
${csum})"
713 check__bad=1 check__runx=1
716 if [ -z "${check__bad}" ]; then
717 TESTS_OK=`add ${TESTS_OK} 1`
719 TESTS_FAILED=`add ${TESTS_FAILED} 1`
722 if [ -n "${CHECK}${RUN_TEST}" ]; then
723 x="t.
${TEST_NAME}-${tid}"
724 if [ -n "${RUN_TEST}" ] ||
725 [ -n "${check__runx}" -a -n "${GIT_REPO}" ]; then
726 ${cp} -f "${f}" ../"${x}"
729 if [ -n "${check__runx}" ] && [ -n "${GIT_REPO}" ] &&
730 command -v diff >/dev
/null
2>&1; then
732 if (git rev-parse
--verify $y) >/dev
/null
2>&1; then :; else
733 y
=refs
/remotes
/origin
/test-out
734 (git rev-parse
--verify $y) >/dev
/null
2>&1 || y
=
736 if [ -n "${y}" ]; then
737 if GIT_CONFIG
=/dev
/null git show
"${y}":"${x}" > \
738 ..
/"${x}".old
2>/dev
/null
; then
739 diff -ru ..
/"${x}".old ../"${x}" > ../"${x}".
diff
740 if [ ${?} -eq 0 ]; then
741 [ -z "${MAILX_CC_TEST_NO_CLEANUP}" ] &&
742 ${rm} -f ../"${x}" ../"${x}".old ../"${x}".diff
743 elif [ -n "${MAILX_CC_ALL_TESTS_DUMPERR}" ]; then
745 printf 'ERROR-DIFF %s\n' "${l}"
746 done < ../"${x}".diff
749 t_echo0err "${tid}: misses
[test-out
] template
"
757 # $1=test name [$2=status]
759 [ ${#} -gt 1 ] && __qm__=${2}
761 TESTS_PERFORMED=`add ${TESTS_PERFORMED} 1`
763 if [ ${__qm__} -ne 0 ]; then
765 t_echoerr "${1}: unexpected non-0
exit status
: ${__qm__}"
766 TESTS_FAILED=`add ${TESTS_FAILED} 1`
769 TESTS_OK=`add ${TESTS_OK} 1`
774 # $1=test name [$2=status]
776 [ ${#} -gt 1 ] && __qm__=${2}
777 [ ${#} -gt 2 ] && __expect__=${3} || __expect__=
779 TESTS_PERFORMED=`add ${TESTS_PERFORMED} 1`
781 if [ ${__qm__} -eq 0 ]; then
783 t_echoerr "${1}: unexpected
0 exit status
: ${__qm__}"
784 TESTS_FAILED=`add ${TESTS_FAILED} 1`
785 elif [ -n "${__expect__}" ] && [ ${__expect__} -ne ${__qm__} ]; then
787 t_echoerr
"${1}: unexpected exit status: ${__qm__} != ${__expected__}"
788 TESTS_FAILED
=`add ${TESTS_FAILED} 1`
791 TESTS_OK
=`add ${TESTS_OK} 1`
797 [ -n "${NOCOLOUR}" ] && return
798 [ -n "${MAILX_CC_TEST_NO_COLOUR}" ] && return
799 # We do not want color for "make test > .LOG"!
800 if command -v stty
>/dev
/null
2>&1 && command -v tput >/dev
/null
2>&1 &&
801 (<&1 >/dev
/null stty
-a) 2>/dev
/null
; then
802 { sgr0
=`tput sgr0`; } 2>/dev
/null
803 [ $?
-eq 0 ] ||
return
804 { saf1
=`tput setaf 1`; } 2>/dev
/null
805 [ $?
-eq 0 ] ||
return
806 { saf2
=`tput setaf 2`; } 2>/dev
/null
807 [ $?
-eq 0 ] ||
return
808 { saf3
=`tput setaf 3`; } 2>/dev
/null
809 [ $?
-eq 0 ] ||
return
810 { b
=`tput bold`; } 2>/dev
/null
811 [ $?
-eq 0 ] ||
return
813 COLOR_ERR_ON
=${saf1}${b} COLOR_ERR_OFF=${sgr0}
814 COLOR_WARN_ON
=${saf3}${b} COLOR_WARN_OFF=${sgr0}
815 COLOR_OK_ON
=${saf2} COLOR_OK_OFF
=${sgr0}
816 unset saf1 saf2 saf3 b
820 if ( [ "$((1 + 1))" = 2 ] ) >/dev
/null
2>&1; then
822 echo "$((${1} + ${2}))"
826 ${awk} 'BEGIN{print '${1}' + '${2}'}'
830 if ( [ "$((2 % 3))" = 2 ] ) >/dev/null 2>&1; then
832 echo "$((${1} % ${2}))"
836 ${awk} 'BEGIN{print '${1}' % '${2}'}'
841 ( "${RAWMAILX}" ${ARGS} -X'echo $features' -Xx |
842 ${grep} +${1}, ) >/dev
/null
2>&1
846 # Absolute Basics {{{
847 t_X_Y_opt_input_go_stack
() {
850 ${cat} <<- '__EOT' > "${BODY}"
858 echo "define mac1 {";\
859 echo " echo mac1-1 via1 \$0";\
861 echo " echo mac1-2";\
863 echo " echo mac1-3";\
866 echo "define mac2 {";\
867 echo " echo mac2-1 via1 \$0";\
869 echo " echo mac2-2";\
875 echo echo 1-1-1 via1 \$0;\
887 # The -X option supports multiline arguments, and those can internally use
888 # reverse solidus newline escaping. And all -X options are joined...
890 < "${BODY}" ${MAILX} ${ARGS} \
905 echo "define mac1 {";\
906 echo " echo mac1-1 via2 \$0";\
908 echo " echo mac1-2";\
910 echo " echo mac1-3";\
913 echo "define mac2 {";\
914 echo " echo mac2-1 via2 \$0";\
916 echo " echo mac2-2";\
922 echo echo 1-1-1 via2 \$0;\
936 check 1 0 "${MBOX}" '1786542668 416'
938 # The -Y option supports multiline arguments, and those can internally use
939 # reverse solidus newline escaping.
941 < "${BODY}" ${MAILX} ${ARGS} \
958 echo "define mac1 {";\
959 echo " echo mac1-1 via2 \$0";\
961 echo " echo mac1-2";\
963 echo " echo mac1-3";\
966 echo "define mac2 {";\
967 echo " echo mac2-1 via2 \$0";\
969 echo " echo mac2-2";\
975 echo echo 1-1-1 via2 \$0;\
988 -Y 'echo LAST_Y' > "${MBOX}"
990 check 2 0 "${MBOX}" '1845176711 440'
993 </dev/null ${MAILX} ${ARGS} \
994 -X 'echo X before compose mode' \
995 -Y '~s Subject via -Y' \
996 -Y 'Body via -Y' -. .
/.tybox
> "${MBOX}" 2>&1
997 check
3 0 .
/.tybox
'264636255 125'
998 check
4 - "${MBOX}" '467429373 22'
1000 ${cat} <<-_EOT | ${MAILX} ${ARGS} -t \
1001 -X 'echo X before compose mode' \
1002 -Y '~s Subject via -Y' \
1003 -Y 'Additional body via -Y' -. .
/.tybox
> "${MBOX}" 2>&1
1005 subject
:diet not to be seen
!
1009 check
5 0 .
/.tybox
'3313167452 299'
1010 check
6 - "${MBOX}" '467429373 22'
1013 printf 'this body via stdin pipe.\n' |
${MAILX} ${NOBATCH_ARGS} \
1014 -X 'echo X before compose mode' \
1015 -Y '~s Subject via -Y (not!)' \
1016 -Y 'Additional body via -Y, nobatch mode' -. .
/.tybox
> "${MBOX}" 2>&1
1017 check
7 0 .
/.tybox
'1561798488 476'
1018 check
8 - "${MBOX}" '467429373 22'
1020 printf 'this body via stdin pipe.\n' |
${MAILX} ${ARGS} \
1021 -X 'echo X before compose mode' \
1022 -Y '~s Subject via -Y' \
1023 -Y 'Additional body via -Y, batch mode' -. .
/.tybox
> "${MBOX}" 2>&1
1024 check
9 0 .
/.tybox
'3245082485 650'
1025 check
10 - "${MBOX}" '467429373 22'
1027 # Test for [8412796a] (n_cmd_arg_parse(): FIX token error -> crash, e.g.
1028 # "-RX 'bind;echo $?' -Xx".., 2018-08-02)
1029 ${MAILX} ${ARGS} -RX'call;echo $?' -Xx > .
/.tall
2>&1
1030 ${MAILX} ${ARGS} -RX'call ;echo $?' -Xx >> .
/.tall
2>&1
1031 ${MAILX} ${ARGS} -RX'call ;echo $?' -Xx >> .
/.tall
2>&1
1032 ${MAILX} ${ARGS} -RX'call ;echo $?' -Xx >> .
/.tall
2>&1
1033 check cmdline
0 .
/.tall
'1867586969 8'
1041 if have_feat uistrings
; then :; else
1042 t_echoskip
'[!UISTRINGS]'
1047 ${cat} <<- '__EOT' > "${BODY}"
1053 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
1054 -X'echo one' -X' echos nono ' -X'echo two' \
1056 check 1 0 "${MBOX}" '2700500141 51'
1058 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Snomemdebug \
1060 check 2 0 "${MBOX}" '2700500141 51'
1062 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u
-Snomemdebug \
1064 check
3 0 "${MBOX}" '2700500141 51'
1068 </dev
/null
${MAILX} ${ARGS} -Serrexit -Snomemdebug \
1069 -X'echo one' -X' echos nono ' -X'echo two' \
1071 check
4 1 "${MBOX}" '4096689457 47'
1073 </dev
/null
${MAILX} ${ARGS} -X'source '"${BODY}" -Serrexit -Snomemdebug \
1075 check 5 1 "${MBOX}" '4096689457 47'
1077 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u
-Serrexit -Snomemdebug \
1079 check
6 1 "${MBOX}" '1669262132 170'
1081 </dev
/null MAILRC
="${BODY}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
1083 check 7 1 "${MBOX}" '1669262132 170'
1085 ## Repeat 4-7 with ignerr set
1087 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
1089 </dev
/null
${MAILX} ${ARGS} -Serrexit -Snomemdebug \
1090 -X'echo one' -X'ignerr echos nono ' -X'echo two' \
1092 check
8 0 "${BODY}" '2700500141 51'
1094 </dev
/null
${MAILX} ${ARGS} -X'source '"${MBOX}" -Serrexit -Snomemdebug \
1096 check 9 0 "${BODY}" '2700500141 51'
1098 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u
-Serrexit -Snomemdebug \
1100 check
10 0 "${BODY}" '2700500141 51'
1102 </dev
/null MAILRC
="${MBOX}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
1104 check 11 0 "${BODY}" '2700500141 51'
1106 # Ensure "good-injection
" in a deeper indirection does not cause trouble
1107 # This actually only works with MLE and HISTORY, and TODO needs a pseudo TTY
1108 # interaction so that we DO initialize our line editor...
1109 ${cat} <<- '__EOT' > "${BODY}"
1120 printf 'source %s\ncall x\necho au' "${BODY}" |
1121 ${MAILX} ${ARGS} -Snomemdebug -Sxarg=errexit > "${MBOX}" 2>&1
1122 check
12 1 "${MBOX}" '2908921993 44'
1124 printf 'source %s\nset on-history-addition=oha\ncall x\necho au' "${BODY}" |
1125 ${MAILX} ${ARGS} -Snomemdebug -Sxarg=errexit > "${MBOX}" 2>&1
1126 check 13 1 "${MBOX}" '2908921993 44'
1128 printf 'source %s\ncall x\necho au' "${BODY}" |
1129 ${MAILX} ${ARGS} -Snomemdebug -Sxarg=nowhere > "${MBOX}" 2>&1
1130 check
14 0 "${MBOX}" '2049365617 47'
1138 if have_feat uistrings
; then :; else
1139 t_echoskip
'[!UISTRINGS]'
1144 ${cat} <<- '__EOT' > "${BODY}"
1150 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
1151 -Y'echo one' -Y' echos nono ' -Y'echo two' \
1153 check 1 0 "${MBOX}" '2700500141 51'
1155 </dev/null ${MAILX} ${ARGS} -Y'source '"${BODY}" -Snomemdebug \
1157 check 2 0 "${MBOX}" '2700500141 51'
1161 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
1162 -Y'echo one' -Y' echos nono ' -Y'echo two' \
1164 check 3 1 "${MBOX}" '4096689457 47'
1166 </dev/null ${MAILX} ${ARGS} -Y'source '"${BODY}" -Serrexit -Snomemdebug \
1168 check 4 1 "${MBOX}" '4096689457 47'
1170 ## Repeat 3-4 with ignerr set
1172 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
1174 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
1175 -Y'echo one' -Y'ignerr echos nono ' -Y'echo two' \
1177 check 5 0 "${BODY}" '2700500141 51'
1179 </dev/null ${MAILX} ${ARGS} -Y'source '"${MBOX}" -Serrexit -Snomemdebug \
1181 check 6 0 "${BODY}" '2700500141 51'
1191 # Test basic assumption
1192 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} \
1193 -X'echo asksub<$asksub> dietcurd<$dietcurd>' \
1194 -Xx > "${MBOX}" 2>&1
1195 check 1 0 "${MBOX}" '270686329 21'
1198 ${cat} <<- '__EOT' > "${BODY}"
1199 echo asksub<$asksub>
1201 echo asksub<$asksub>
1203 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
1204 -Snoasksub -Sasksub -Snoasksub \
1205 -X'echo asksub<$asksub>' -X'set asksub' -X'echo asksub<$asksub>' \
1206 -Xx > "${MBOX}" 2>&1
1207 check
2 0 "${MBOX}" '3182942628 37'
1209 ${cat} <<- '__EOT' > "${BODY}"
1210 echo asksub<$asksub>
1212 echo asksub<$asksub>
1214 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
1215 -Snoasksub -Sasksub \
1216 -X'echo asksub<$asksub>' -X'unset asksub' -X'echo asksub<$asksub>' \
1217 -Xx > "${MBOX}" 2>&1
1218 check
3 0 "${MBOX}" '2006554293 39'
1221 ${cat} <<- '__EOT' > "${BODY}"
1222 echo dietcurd<$dietcurd>
1224 echo dietcurd<$dietcurd>
1226 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
1227 -Sdietcurd=strawberry
-Snodietcurd -Sdietcurd=vanilla \
1228 -X'echo dietcurd<$dietcurd>' -X'unset dietcurd' \
1229 -X'echo dietcurd<$dietcurd>' \
1230 -Xx > "${MBOX}" 2>&1
1231 check
4 0 "${MBOX}" '1985768109 65'
1233 ${cat} <<- '__EOT' > "${BODY}"
1234 echo dietcurd<$dietcurd>
1236 echo dietcurd<$dietcurd>
1238 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
1239 -Sdietcurd=strawberry
-Snodietcurd \
1240 -X'echo dietcurd<$dietcurd>' -X'set dietcurd=vanilla' \
1241 -X'echo dietcurd<$dietcurd>' \
1242 -Xx > "${MBOX}" 2>&1
1243 check
5 0 "${MBOX}" '151574279 51'
1245 # TODO once we have a detached one with env=1..
1246 if [ -n "`</dev/null ${MAILX} ${ARGS} -X'!echo \$TERM' -Xx`" ]; then
1247 t_echoskip
's_freeze-{6,7}:[shell sets $TERM]'
1249 ${cat} <<- '__EOT' > "${BODY}"
1250 !echo "shell says TERM<$TERM>"
1252 !echo "shell says TERM<$TERM>"
1254 !echo "shell says TERM<$TERM>"
1256 !echo "shell says TERM<$TERM>"
1258 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
1259 -STERM=strawberry
-SnoTERM -STERM=vanilla \
1260 -X'echo mail<$TERM>' -X'unset TERM' \
1261 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
1262 -Xx > "${MBOX}" 2>&1
1263 check
6 0 "${MBOX}" '1211476036 167'
1265 ${cat} <<- '__EOT' > "${BODY}"
1266 !echo "shell says TERM<$TERM>"
1268 !echo "shell says TERM<$TERM>"
1270 !echo "shell says TERM<$TERM>"
1272 !echo "shell says TERM<$TERM>"
1274 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
1275 -STERM=strawberry
-SnoTERM \
1276 -X'echo TERM<$TERM>' -X'set TERM=vanilla' \
1277 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
1278 -Xx > "${MBOX}" 2>&1
1279 check
7 0 "${MBOX}" '3365080441 132'
1289 t__gen_msg subject f-batch-order
> "${MBOX}"
1291 # This would exit 64 (EX_USAGE) from ? to [fbddb3b3] (FIX: -f: add
1292 # n_PO_f_FLAG to avoid that command line order matters)
1293 </dev
/null
${MAILX} ${NOBATCH_ARGS} -R -f -# \
1294 -Y 'echo du;h;echo da;x' "${MBOX}" >.
/.tall
2>&1
1295 check
1 0 .
/.tall
'1690247457 86'
1297 # And this ever worked (hopefully)
1298 </dev
/null
${MAILX} ${NOBATCH_ARGS} -R -# -f \
1299 -Y 'echo du;h;echo da;x' "${MBOX}" >.
/.tall
2>&1
1300 check
2 0 .
/.tall
'1690247457 86'
1305 t_input_inject_semicolon_seq
() {
1308 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1310 echon '(mydeepmac)';
1313 echon this_is_mymac;call mydeepmac;echon ';';
1315 echon one';';call mymac;echon two";";call mymac;echo three$';';
1317 echon this_is_mymac;call mydeepmac;echon ,TOO'!;';
1319 echon one';';call mymac;echon two";";call mymac;echo three$';';
1322 check 1 0 "${MBOX}" '512117110 140'
1330 ${cat} <<- '__EOT' > "${BODY}"
1349 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
1350 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
1351 echo $
'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
1353 echo a$
'\101\0101\x41\u0041\u41\U00000041\U41'c
1354 echo a$
'\u0041\u41\u0C1\U00000041\U41'c
1376 echo a$
'b\U000000'ds
1377 echo a$
'b\U0000000'dt
1378 echo a$
'b\U00000000'du
1388 if [ -z "${UTF8_LOCALE}" ]; then
1389 t_echoskip
'wysh-unicode:[no UTF-8 locale]'
1391 < "${BODY}" DIET
=CURD TIED
= \
1392 LC_ALL
=${UTF8_LOCALE} ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
1393 check unicode
0 "${MBOX}" '475805847 317'
1396 < "${BODY}" DIET=CURD TIED= ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
1397 check c 0 "${MBOX}" '1473887148 321'
1399 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1400 wysh
set mager
='\hey\'
1402 wysh set mager="\hey\\"
1404 wysh set mager=$'\hey
\\'
1407 check 3 0 "${MBOX}" '1289698238 69'
1415 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1416 commandalias echo echo hoho
1420 commandalias XxX XxXx
1421 commandalias XxXx XxXxX
1422 commandalias XxXxX XxXxXx
1423 commandalias XxXxXx echo huhu
1424 commandalias XxXxXxX echo huhu
1426 commandalias XxXxXx XxXxXxX
1429 commandalias XxXxXx echo huhu
1433 check 1 0 "${MBOX}" '1638809585 36'
1441 # In POSIX C181 standard order
1442 </dev/null ${MAILX} ${ARGS} \
1443 -Y 'echon alias
/a\
; ? a
; echon group
/g\
; ?g
' \
1444 -Y 'echon alternates
/alt\
; ? alt
' \
1445 -Y 'echon chdir
/ch\
; ? ch
' \
1446 -Y 'echon copy
/c\
; ? c
; echon Copy
/C\
; ?C
' \
1447 -Y 'echon delete
/d\
; ? d
' \
1448 -Y 'echon discard
/di\
; ? di
; echon ignore
/ig\
; ?ig
' \
1449 -Y 'echon echo
/ec\
; ? ec
' \
1450 -Y 'echon edit
/e\
; ? e
' \
1451 -Y 'echon exit
/ex\
; ? ex
; echon xit
/x\
; ?x
' \
1452 -Y 'echon file
/fi\
; ?
fi; echon folder
/fold\
; ?
fold' \
1453 -Y 'echon followup
/fo\
; ? fo
; echon Followup
/F\
; ?F
' \
1454 -Y 'echon from
/f\
; ? f
' \
1455 -Y 'echon headers
/h\
; ? h
' \
1456 -Y 'echon help
/hel\
; ? hel
' \
1457 -Y 'echon hold
/ho\
; ? ho
; echon preserve
/pre\
; ? pre
' \
1458 -Y 'echon if
/i\
; ? i
; echon else
/el\
; ? el
; echon endif
/en\
; ? en
' \
1459 -Y 'echon list
/l\
; ? l
' \
1460 -Y 'echon mail
/m\
; ? m
' \
1461 -Y 'echon mbox
/mb\
; ? mb
' \
1462 -Y 'echon next
/n\
; ? n
' \
1463 -Y 'echon pipe
/pi\
; ? pi
' \
1464 -Y 'echon Print
/P\
; ? P
; echon Type
/T\
; ? T
' \
1465 -Y 'echon print
/p\
; ? p
; echon type
/t\
; ? t
' \
1466 -Y 'echon quit
/q\
; ? q
' \
1467 -Y 'echon Reply
/R\
; ? R
' \
1468 -Y 'echon reply
/r\
; ? r
' \
1469 -Y 'echon retain
/ret\
; ? ret
' \
1470 -Y 'echon save
/s\
; ? s
; echon Save
/S\
; ? S
' \
1471 -Y 'echon set
/se\
; ? se
' \
1472 -Y 'echon shell
/sh\
; ? sh
' \
1473 -Y 'echon size
/si\
; ? si
' \
1474 -Y 'echon source
/so\
; ? so
' \
1475 -Y 'echon touch
/tou\
; ? tou
' \
1476 -Y 'echon unalias
/una\
; ? una
' \
1477 -Y 'echon undelete
/u\
; ? u
' \
1478 -Y 'echon unset
/uns\
; ? uns
' \
1479 -Y 'echon visual
/v\
; ? v
' \
1480 -Y 'echon write
/w\
; ? w
' \
1481 | ${sed} -e 's
/:.
*$
//' > "${MBOX}"
1482 check 1 0 "${MBOX}" '1012680481 968'
1492 # XXX the first needs to be checked, it is quite dumb as such
1493 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1494 commandalias x echo '$?
/$^ERRNAME
'
1507 shcodec e a$'b
'c$'d
'
1509 shcodec d a$'b
'c$'d
'
1523 # same but with vput
1524 commandalias y echo '$?
/$^ERRNAME
$res'
1525 vput shcodec res e abcd
1529 vput shcodec res d abcd
1533 vput shcodec res e a'b
'c'd
'
1537 vput shcodec res d a'b
'c'd
'
1541 vput shcodec res e a"b"c"d"
1545 vput shcodec res d a"b"c"d"
1549 vput shcodec res e a$'b
'c$'d
'
1553 vput shcodec res d a$'b
'c$'d
'
1557 vput shcodec res e 'abcd
'
1561 vput shcodec res d 'abcd
'
1565 vput shcodec res e "abcd"
1569 vput shcodec res d "abcd"
1573 vput shcodec res e $'abcd
'
1577 vput shcodec res d $'abcd
'
1582 vput shcodec res e a b\ c d
1586 vput shcodec res d a b\ c d
1588 vput shcodec res e ab cd
1592 vput shcodec res d 'ab
cd'
1594 vput shcodec res e a 'b c
' d
1598 vput shcodec res d a 'b c
' d
1600 vput shcodec res e a "b c" d
1604 vput shcodec res d a "b c" d
1606 vput shcodec res e a $'b c
' d
1610 vput shcodec res d a $'b c
' d
1613 vput shcodec res e 'a$
`"\'
1617 vput shcodec res d 'a$`"\'
1619 vput shcodec res e "a\$\
`'\"\\"
1623 vput shcodec res d "a\$\`'\"\\"
1625 vput shcodec res e $'a\$
`\'\"\\'
1629 vput shcodec res d $'a\$`\'\"\\'
1631 vput shcodec res e $'a\$
`\'"\\'
1635 vput shcodec res d $'a\$`\'"\\'
1639 vput shcodec res e a${diet}c
1643 eval vput shcodec res e a${diet}c
1647 vput shcodec res e "a
${diet}c
"
1651 eval vput shcodec res e "a
${diet}c
"
1656 check 1 0 "${MBOX}" '3316745312 1241'
1658 if [ -z "${UTF8_LOCALE}" ]; then
1659 t_echoskip 'unicode:[no UTF-8 locale]'
1660 elif have_feat multibyte-charsets; then
1661 ${cat} <<- '__EOT' | LC_ALL=${UTF8_LOCALE} \
1662 ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
1666 shcodec d $'t\u00E4st'
1669 shcodec d $'a\u054Dc'
1672 shcodec d $'a\U0001D542c'
1674 check unicode 0 "${MBOX}" '1175985867 77'
1676 t_echoskip 'unicode:[!MULTIBYTE-CHARSETS]'
1685 # v15compat: old and new tests share the same result files!
1686 # v15compat: i.e., just throw away -old tests one day
1688 # Nestable conditions test
1689 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1711 if $dietcurd == 'yoho'
1716 if $dietcurd ==?
'Yoho'
1721 if $dietcurd == 'Yoho'
1726 if $dietcurd != 'yoho'
1731 if $dietcurd !=?
case 'Yoho'
1736 if $dietcurd != 'Yoho'
1797 if $dietcurd == 'yohu'
1799 elif $dietcurd == 'yoha'
1801 elif $dietcurd == 'yohe'
1803 elif $dietcurd == 'yoho'
1805 if $dietcurd == 'yohu'
1807 elif $dietcurd == 'yoha'
1809 elif $dietcurd == 'yohe'
1811 elif $dietcurd == 'yoho'
1813 if $dietcurd == 'yohu'
1815 elif $dietcurd == 'yoha'
1817 elif $dietcurd == 'yohe'
1819 elif $dietcurd == 'yoho'
1875 if $dietcurd ==?
case aBC
1880 if $dietcurd >=?ca AbC
1885 if $dietcurd <=? ABc
1890 if $dietcurd >=?
case abd
1895 if $dietcurd <=? abb
1923 if $dietcurd =%?
case aB
1968 set diet
=abc curd
=abc
1974 set diet
=abc curd
=abcd
1980 # 1. Shitty grouping capabilities as of today
1981 unset diet curd ndefined
1982 if [ [ false
] ||
[ false
] ||
[ true
] ] && \
1983 [ [ false
] ||
[ true
] ] && \
1989 if [ [ [ [ 0 ] ||
[ 1 ] ] && [ [ 1 ] ||
[ 0 ] ] ] && [ 1 ] ] && [ yes ]
1994 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ]
1999 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ]
2004 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] && [ no
]
2009 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] \
2010 && [ no
] ||
[ yes ]
2015 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
2020 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
2025 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
2030 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
2035 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 0 ]
2040 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 1 ]
2045 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ]
2050 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 1 ]
2055 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 0 ]
2060 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 1 ]
2066 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
2072 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
2077 # 2. Shitty grouping capabilities as of today
2078 unset diet curd ndefined
2079 if [ false || false || true
] && [ false || true
] && yes
2084 if [ [ [ 0 ||
1 ] && [ 1 ||
0 ] ] && 1 ] && [ yes ]
2089 if [ 1 ||
0 ||
0 ||
0 ]
2094 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ]
2099 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ||
1 ] && no
2104 if [ 1 ||
0 ||
0 ||
0 ||
1 ||
[ 1 ] ] && no ||
[ yes ]
2109 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
2114 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
2119 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
2124 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
2129 if 1 ||
0 ||
0 ||
0 && 0
2134 if 1 ||
0 ||
0 ||
0 && 1
2139 if 0 ||
0 ||
0 ||
1 && 0
2144 if 0 ||
0 ||
0 ||
1 && 1
2149 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 0
2154 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 1
2160 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
2165 if $diet == 'yo' && $curd == 'ho' && $ndefined
2171 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
2176 if $diet == 'yo' && $curd == 'ho' && $ndefined
2181 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
2186 # Some more en-braced variables
2188 if ${diet} == ${curd}
2193 if ${diet} != ${curd}
2209 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
2214 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
2219 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
2224 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
2229 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
2234 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
2239 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
2244 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] ||
3
2249 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
2255 if ! 0 && ! ! 1 && ! ! ! 0 && 3
2260 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
2265 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
2270 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
2275 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
2280 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
2285 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
2290 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] ||
3
2295 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
2302 check normal-old
0 "${MBOX}" '1688759742 719' # pre v15compat
2304 if have_feat regex
; then
2305 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
2307 if $dietcurd =~ '^yo.*'
2312 if $dietcurd =~ '^Yo.*'
2317 if $dietcurd =~?case '^Yo.*'
2322 if $dietcurd =~ '^yOho.+'
2327 if $dietcurd !~? '.*Ho$'
2332 if $dietcurd !~ '.+yohO$'
2337 if [ $dietcurd !~?cas '.+yoho$' ]
2342 if ! [ $dietcurd =~?case '.+yoho$' ]
2347 if ! ! [ $dietcurd !~? '.+yoho$' ]
2352 if ! [ ! [ $dietcurd !~? '.+yoho$' ] ]
2357 if [ ! [ ! [ $dietcurd !~? '.+yoho$' ] ] ]
2362 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
2367 if ! ! ! $dietcurd !~ '.+yoho$'
2372 if ! ! ! $dietcurd =~ '.+yoho$'
2377 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
2382 set diet=abc curd='^abc$'
2388 set diet=abc curd='^abcd$'
2396 check regex-old 0 "${MBOX}" '1115671789 95' # pre v15compat
2398 t_echoskip 'regex-old:[no regex option]'
2403 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Sv15-compat=X > "${MBOX}"
2404 \
if -N xyz
; echo 1.err-1
; \
2405 \
elif ! -Z xyz
;echo 1.err-2
;\
2406 \
elif -n "$xyz" ; echo 1.err-3
; \
2407 \
elif ! -z "$xyz" ; echo 1.err-4
; \
2411 \
if ! -N xyz
; echo 2.err-1
; \
2412 \
elif -Z xyz
;echo 2.err-2
;\
2413 \
elif -n "$xyz" ; echo 2.err-3
; \
2414 \
elif ! -z "$xyz" ; echo 2.err-4
; \
2418 \
if ! -N xyz
; echo 3.err-1
; \
2419 \
elif -Z xyz
;echo 3.err-2
;\
2420 \
elif ! -n "$xyz";echo 3.err-3
;\
2421 \
elif -z "$xyz";echo 3.err-4
;\
2424 \
if $xyz != notempty
;echo 4.err-1
;else;echo 4.ok
;\end
2425 \
if $xyz == notempty
;echo 5.ok
;else;echo 5.err-1
;\end
2428 check NnZz_whiteout
0 "${MBOX}" '4280687462 25'
2430 # TODO t_ifelse: individual tests as for NnZz_whiteout
2431 # Nestable conditions test
2432 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Sv15-compat=x > "${MBOX}"
2443 if [ "$dietcurd" != "" ]
2449 if $'\$dietcurd' != ""
2454 if "$dietcurd" == 'yoho'
2459 if $'\$dietcurd' ==? 'Yoho'
2464 if $dietcurd == 'Yoho'
2469 if $dietcurd != 'yoho'
2474 if $dietcurd !=?case 'Yoho'
2479 if $dietcurd != 'Yoho'
2540 if $dietcurd == 'yohu'
2542 elif $dietcurd == 'yoha'
2544 elif $dietcurd == 'yohe'
2546 elif $dietcurd == 'yoho'
2548 if $dietcurd == 'yohu'
2550 elif $dietcurd == 'yoha'
2552 elif $dietcurd == 'yohe'
2554 elif $dietcurd == 'yoho'
2556 if $dietcurd == 'yohu'
2558 elif $dietcurd == 'yoha'
2560 elif $dietcurd == 'yohe'
2562 elif $dietcurd == 'yoho'
2602 if $dietcurd -ge?satu -0xFFFFFFFFFFFFFFFF1
2618 if $dietcurd ==?case aBC
2623 if $dietcurd >=?ca AbC
2628 if $dietcurd <=? ABc
2633 if $dietcurd >=?case abd
2638 if $dietcurd <=? abb
2666 if $dietcurd =%?case aB
2711 set diet='ab c' curd='ab c'
2712 if "$diet" == "$curd"
2717 set diet='ab c' curd='ab cd'
2718 if "$diet" != "$curd"
2723 # 1. Shitty grouping capabilities as of today
2724 unset diet curd ndefined
2725 if [ [ false ] || [ false ] || [ true ] ] && \
2726 [ [ false ] || [ true ] ] && \
2732 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
2737 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
2742 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
2747 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
2752 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
2753 && [ no ] || [ yes ]
2758 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
2763 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
2768 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
2773 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
2778 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
2783 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
2788 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
2793 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
2798 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
2803 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
2809 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && \
2810 [ -N ndefined || -n "$ndefined" || \
2811 ! -Z ndefined || ! -z "$ndefined" ]
2817 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && \
2818 -N ndefined && ! -n "$ndefined" && \
2819 ! -Z ndefined && -z "$ndefined"
2824 # 2. Shitty grouping capabilities as of today
2825 unset diet curd ndefined
2826 if [ false || false || true ] && [ false || true ] && yes
2831 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
2836 if [ 1 || 0 || 0 || 0 ]
2841 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
2846 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
2851 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
2856 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
2861 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
2866 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
2871 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
2876 if 1 || 0 || 0 || 0 && 0
2881 if 1 || 0 || 0 || 0 && 1
2886 if 0 || 0 || 0 || 1 && 0
2891 if 0 || 0 || 0 || 1 && 1
2896 if 0 || 0 || 0 || 1 && 0 || 1 && 0
2901 if 0 || 0 || 0 || 1 && 0 || 1 && 1
2907 if [ $diet == 'yo' && $curd == 'ho' ] && \
2908 [ -N ndefined || -n "$ndefined" || \
2909 ! -Z ndefined || ! -z "$ndefined" ]
2914 if [ $diet == 'yo' && $curd == 'ho' && \
2915 [ [ -N ndefined || -n "$ndefined" || \
2916 ! -Z ndefined || ! -z "$ndefined" ] ] ]
2922 if [ $diet == 'yo' && $curd == 'ho' ] && \
2923 -N ndefined && ! -n "$ndefined" && \
2924 ! -Z ndefined && -z "$ndefined"
2929 if $diet == 'yo' && $curd == 'ho' && ! -Z ndefined
2934 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && -N ndefined ] ] ] ] ] ]
2939 # Some more en-braced variables
2941 if ${diet} == ${curd}
2946 if "${diet}" != "${curd}"
2962 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
2967 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
2972 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
2977 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
2982 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
2987 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
2992 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
2997 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
3002 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
3008 if ! 0 && ! ! 1 && ! ! ! 0 && 3
3013 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
3018 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
3023 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
3028 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
3033 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
3038 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
3043 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
3048 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
3055 check normal 0 "${MBOX}" '1688759742 719'
3057 if have_feat regex; then
3058 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Sv15-compat=X > "${MBOX}"
3060 if $dietcurd =~
'^yo.*'
3065 if "$dietcurd" =~
'^Yo.*'
3070 if $dietcurd =~?
case '^Yo.*'
3075 if $dietcurd =~
'^yOho.+'
3080 if $dietcurd !~?
'.*Ho$'
3085 if $dietcurd !~
'.+yohO$'
3090 if [ $dietcurd !~?cas
'.+yoho$' ]
3095 if ! [ "$dietcurd" =~?
case '.+yoho$' ]
3100 if ! ! [ $
'\$dietcurd' !~?
'.+yoho$' ]
3105 if ! [ ! [ $dietcurd !~?
'.+yoho$' ] ]
3110 if [ ! [ ! [ $dietcurd !~?
'.+yoho$' ] ] ]
3115 if ! [ ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
3120 if ! ! ! $dietcurd !~
'.+yoho$'
3125 if ! ! ! $dietcurd =~
'.+yoho$'
3130 if ! [ ! ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
3135 set diet
=abc curd
='^abc$'
3141 set diet
=abc curd
='^abcd$'
3142 if "$diet" !~ $
'\$curd'
3149 check regex
0 "${MBOX}" '1115671789 95'
3151 t_echoskip
'regex:[!REGEX]'
3160 # Nestable conditions test
3161 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3176 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
3181 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
3182 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
3191 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
3193 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
3202 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
3209 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
3216 echo ----- $1: $2 -> $3 -> $4
3224 call llx 'call off' on on on
3225 call llx 'call off' off on on
3226 call llx 'call off' on off on
3227 call llx 'call off' on off off
3228 localopts call-fixate on
3229 call llx 'call-fixate on' on on on
3230 call llx 'call-fixate on' off on on
3231 call llx 'call-fixate on' on off on
3232 call llx 'call-fixate on' on off off
3233 unset x;localopts call on
3234 call llx 'call on' on on on
3235 call llx 'call on' off on on
3236 call llx 'call on' on off on
3237 call llx 'call on' on off off
3242 check 1 0 "${MBOX}" '4016155249 1246'
3250 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3278 echo ------- global-1 du
=$du
3280 echo ------- global-2 du
=$du
3283 echo ------- global-3 du
=$du
3285 echo ------- global-4 du
=$du
3287 echo ------- global-5 du
=$du
3289 check
1 0 "${MBOX}" '2411598140 641'
3292 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3294 echo z-1: x=$x y=$y z=$z crt=$crt
3295 local set z=1 y=2 crt=10
3296 echo z-2: x=$x y=$y z=$z crt=$crt
3299 echo y-1: x=$x y=$y z=$z crt=$crt
3300 local set x=2 y=1 crt=5
3301 echo y-2: x=$x y=$y z=$z crt=$crt
3303 echo y-3: x=$x y=$y z=$z crt=$crt
3306 echo x-1: x=$x y=$y z=$z crt=$crt
3308 echo x-2: x=$x y=$y z=$z crt=$crt
3310 echo x-3: x=$x y=$y z=$z crt=$crt
3313 echo global-1: x=$x y=$y z=$z crt=$crt
3315 echo global-2: x=$x y=$y z=$z crt=$crt
3317 check 2 0 "${MBOX}" '2560788669 216'
3325 ${cat} <<- '__EOT' | EK1=EV1 EK2=EV2 ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3326 echo "we: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3327 !echo "shell: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3328 varshow EK1 EK2 EK3 EK4 NEK5
3330 echo environ
set EK3 EK4
, set NEK5
3331 environ
set EK3
=EV3 EK4
=EV4
3333 echo "we: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3334 !echo "shell: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3335 varshow EK1 EK2 EK3 EK4 NEK5
3337 echo removing NEK5 EK3
3340 echo "we: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3341 !echo "shell: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3342 varshow EK1 EK2 EK3 EK4 NEK5
3344 echo changing EK1
, EK4
3345 set EK1
=EV1_CHANGED EK4
=EV4_CHANGED
3346 echo "we: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3347 !echo "shell: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3348 varshow EK1 EK2 EK3 EK4 NEK5
3350 echo linking EK4
, rechanging EK1
, EK4
3353 echo "we: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3354 !echo "shell: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3355 varshow EK1 EK2 EK3 EK4 NEK5
3359 echo "we: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3360 !echo "shell: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3361 varshow EK1 EK2 EK3 EK4 NEK5
3364 check
1 0 "${MBOX}" '1685686686 1342'
3370 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3372 echo '-------> L4 (environ unlink EK1, own localopts)'
3375 set LK1=LK1_L4 EK1=EK1_L4
3376 echo "we
: L4
: LK1
<$LK1> EK1
<$EK1>"
3377 !echo "shell
: L4
: LK1
<$LK1> EK1
<$EK1>"
3383 set LK1=LK1_L3 EK1=EK1_L3
3384 echo "we
: L3-pre
: LK1
<$LK1> EK1
<$EK1>"
3385 !echo "shell
: L3-pre
: LK1
<$LK1> EK1
<$EK1>"
3388 echo "we
: L3-post
: LK1
<$LK1> EK1
<$EK1>"
3389 !echo "shell
: L3-post
: LK1
<$LK1> EK1
<$EK1>"
3395 set LK1=LK1_L2 EK1=EK1_L2
3396 echo "we
: L2-pre
: LK1
<$LK1> EK1
<$EK1>"
3397 !echo "shell
: L2-pre
: LK1
<$LK1> EK1
<$EK1>"
3400 echo "we
: L2-post
: LK1
<$LK1> EK1
<$EK1>"
3401 !echo "shell
: L2-post
: LK1
<$LK1> EK1
<$EK1>"
3406 echo '-------> L1 (environ link EK1; localopts call-fixate)'
3407 localopts call-fixate yes
3408 set LK1=LK1_L1 EK1=EK1_L1
3410 echo "we
: L1-pre
: LK1
<$LK1> EK1
<$EK1>"
3411 !echo "shell
: L1-pre
: LK1
<$LK1> EK1
<$EK1>"
3414 echo "we
: L1-post
: LK1
<$LK1> EK1
<$EK1>"
3415 !echo "shell
: L1-post
: LK1
<$LK1> EK1
<$EK1>"
3419 echo "we
: outer-pre
: LK1
<$LK1> EK1
<$EK1>"
3420 !echo "shell
: outer-pre
: LK1
<$LK1> EK1
<$EK1>"
3423 echo "we
: outer-post
: LK1
<$LK1> EK1
<$EK1>"
3424 !echo "shell
: outer-post
: LK1
<$LK1> EK1
<$EK1>"
3428 check 2 0 "${MBOX}" '1903030743 1131'
3433 t_macro_param_shift() {
3436 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
3439 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
3444 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
3445 if [ $# > 1 ] || [ $ignerr == '' ]
3450 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
3452 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
3456 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
3461 call t2 1 you get four args
3462 echo t1.1: $?';' ignerr ($ignerr) should not exist
3463 call t2 1 you get 'three args'
3464 echo t1.2: $?';' ignerr ($ignerr) should not exist
3465 call t2 1 you 'get two args'
3466 echo t1.3: $?';' ignerr ($ignerr) should not exist
3467 call t2 1 'you get one arg'
3468 echo t1.4: $?';' ignerr ($ignerr) should not exist
3469 ignerr call t2 '' 'you get one arg'
3470 echo t1.5: $?';' ignerr ($ignerr) should not exist
3475 check 1 0 "${MBOX}" '1402489146 1682'
3483 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3484 commandalias x
echo '$?/$^ERRNAME $res'
3485 vput addrcodec res e
1 <doog@def
>
3487 eval vput addrcodec res d
$res
3489 vput addrcodec res e
2 .
<doog@def
>
3491 eval vput addrcodec res d
$res
3493 vput addrcodec res e
3 Sauer Dr.
<doog@def
>
3495 eval vput addrcodec res d
$res
3497 vput addrcodec res e
3.50 Sauer
(Ma
) Dr.
<doog@def
>
3499 eval vput addrcodec res d
$res
3501 vput addrcodec res e
3.51 Sauer
(Ma
) "Dr." <doog@def
>
3503 eval vput addrcodec res d
$res
3506 vput addrcodec res
+e
4 Sauer
(Ma
) Dr.
<doog@def
>
3508 eval vput addrcodec res d
$res
3510 vput addrcodec res
+e
5 Sauer
(Ma
) Braten Dr.
<doog@def
>
3512 eval vput addrcodec res d
$res
3514 vput addrcodec res
+e
6 Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
>
3516 eval vput addrcodec res d
$res
3518 vput addrcodec res
+e
7 Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
> (bu
)
3520 eval vput addrcodec res d
$res
3522 vput addrcodec res
+e
8 \
3523 Dr. Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
> (bu
) Boom. Boom
3525 eval vput addrcodec res d
$res
3527 vput addrcodec res
+e
9 Dr.Sauer
(Ma
)Braten Dr.
(Heu
) <doog@def
>
3529 eval vput addrcodec res d
$res
3531 vput addrcodec res
+e
10 (Ma
)Braten Dr.
(Heu
) <doog@def
>
3533 eval vput addrcodec res d
$res
3535 vput addrcodec res
+e
11 (Ma
)Braten Dr
"." (Heu
) <doog@def
>
3537 eval vput addrcodec res d
$res
3539 vput addrcodec res
+e
12 Dr. Sauer
(Ma
) Braten Dr.
(u
) <doog@def
>
3541 eval vput addrcodec res d
$res
3543 vput addrcodec res
+e
13(Ma
)Braten Dr.
(Heu
) <doog@def
>
3545 eval vput addrcodec res d
$res
3547 vput addrcodec res
+e
14 Hey
, Du
<doog@def
> Wie
() findet Dr. das?
()
3549 eval vput addrcodec res d
$res
3551 vput addrcodec res
+e
15 \
3552 Hey
, Du
<doog@def
> Wie
() findet
"" Dr.
"" das?
()
3554 eval vput addrcodec res d
$res
3556 vput addrcodec res
+e
16 \
3557 "Hey," "Du" <doog@def
> "Wie()" findet
"" Dr.
"" das?
()
3559 eval vput addrcodec res d
$res
3561 vput addrcodec res
+e
17 \
3562 "Hey" Du
<doog@def
> "Wie() findet " " Dr. """ das?
()
3564 eval vput addrcodec res d
$res
3566 vput addrcodec res
+e
18 \
3567 <doog@def
> "Hey" Du
"Wie() findet " " Dr. """ das?
()
3569 eval vput addrcodec res d
$res
3571 vput addrcodec res
+e
19 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
3573 eval vput addrcodec res d
$res
3576 vput addrcodec res
++e
20 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
3578 vput addrcodec res
++e
21 Hey\
,\"" <doog@def> "Wie
()" findet \" Dr. \" das?
3580 eval vput addrcodec res d $res
3583 vput addrcodec res \
3584 +++e 22 Hey\\,\" <doog@def> "Wie
()" findet \" Dr. \" das?
3586 eval vput addrcodec res d $res
3589 vput addrcodec res s \
3590 "23 Hey
\\,\\\" \"Wie
" () "\" findet
\\\" Dr.
\\\" das?
" <doog@def>
3593 # Fix for [f3852f88]
3594 vput addrcodec res ++e <from2@exam.ple> 100 (comment) "Quot
(e
)d
"
3596 eval vput addrcodec res d $res
3598 vput addrcodec res e <from2@exam.ple> 100 (comment) "Quot
(e
)d
"
3600 eval vput addrcodec res d $res
3604 check 1 0 "${MBOX}" '1047317989 2612'
3606 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3607 commandalias x
echo '$?/$^ERRNAME $res'
3609 mlsubscribe isa2@list
3611 vput addrcodec res skin Hey
\\,\" <isa0@list
> "Wie()" find \" Dr.
\" das?
3613 vput addrcodec res skinlist Hey
\\,\" <isa0@list
> "Wie()" find \" Dr.
\" das?
3615 vput addrcodec res skin Hey
\\,\" <isa1@list
> "Wie()" find \" Dr.
\" das?
3617 vput addrcodec res skinlist Hey
\\,\" <isa1@list
> "Wie()" find \" Dr.
\" das?
3619 vput addrcodec res skin Hey
\\,\" <isa2@list
> "Wie()" find \" Dr.
\" das?
3621 vput addrcodec res skinlist Hey
\\,\" <isa2@list
> "Wie()" find \" Dr.
\" das?
3625 check
2 0 "${MBOX}" '1391779299 104'
3627 if have_feat idna
; then
3628 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} ${ADDARG_UNI} > "${MBOX}" 2>&1
3629 commandalias x echo '$?/$^ERRNAME $res'
3630 vput addrcodec res e (heu) <du@blödiän> "stroh
" du
3632 eval vput addrcodec res d $res
3634 vput addrcodec res e <du@blödiän> du
3636 eval vput addrcodec res d $res
3638 vput addrcodec res e du <du@blödiän>
3640 eval vput addrcodec res d $res
3642 vput addrcodec res e <du@blödiän>
3644 eval vput addrcodec res d $res
3646 vput addrcodec res e du@blödiän
3648 eval vput addrcodec res d $res
3652 check idna 0 "${MBOX}" '498775983 326'
3654 t_echoskip 'idna:[!IDNA]'
3663 if have_feat cmd-csop; then :; else
3664 t_echoskip '[!CMD_CSOP]'
3669 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3670 commandalias x
echo '$?/$^ERRNAME :$res:'
3672 vput csop res
find you y
;x
3673 vput csop res
find you o
;x
3674 vput csop res
find you u
;x
3675 vput csop res
find you yo
;x
3676 vput csop res
find you ou
;x
3677 vput csop res
find you you
;x
3679 vput csop res
find you Y
;x
3680 vput csop res
find? you Y
;x
3681 vput csop res
find?
case you O
;x
3682 vput csop res
find? you U
;x
3683 vput csop res
find?ca you yO
;x
3684 vput csop res
find? you oU
;x
3685 vput csop res
find? you YoU
;x
3687 vput csop res
find 'bananarama' 'nana';x
3688 vput csop res
find 'bananarama' 'bana';x
3689 vput csop res
find 'bananarama' 'Bana';x
3690 vput csop res
find 'bananarama' 'rama';x
3692 vput csop res
find?
'bananarama' 'nana';x
3693 vput csop res
find?
'bananarama' 'bana';x
3694 vput csop res
find?
'bananarama' 'Bana';x
3695 vput csop res
find?
'bananarama' 'rama';x
3697 vput csop res substring
'bananarama' 1;x
3698 vput csop res substring
'bananarama' 3;x
3699 vput csop res substring
'bananarama' 5;x
3700 vput csop res substring
'bananarama' 7;x
3701 vput csop res substring
'bananarama' 9;x
3702 vput csop res substring
'bananarama' 10;x
3703 vput csop res substring
'bananarama' 1 3;x
3704 vput csop res substring
'bananarama' 3 3;x
3705 vput csop res substring
'bananarama' 5 3;x
3706 vput csop res substring
'bananarama' 7 3;x
3707 vput csop res substring
'bananarama' 9 3;x
3708 vput csop res substring
'bananarama' 10 3;x
3710 vput csop res substring
'bananarama' -1;x
3711 vput csop res substring
'bananarama' -3;x
3712 vput csop res substring
'bananarama' -5;x
3713 vput csop res substring
'bananarama' -7;x
3714 vput csop res substring
'bananarama' -9;x
3715 vput csop res substring
'bananarama' -10;x
3716 vput csop res substring
'bananarama' 1 -3;x
3717 vput csop res substring
'bananarama' 3 -3;x
3718 vput csop res substring
'bananarama' 5 -3;x
3719 vput csop res substring
'bananarama' 7 -3;x
3720 vput csop res substring
'bananarama' 9 -3;x
3721 vput csop res substring
'bananarama' 10 -3;x
3723 vput csop res trim
'Cocoon Cocoon';x
3724 vput csop res trim
' Cocoon Cocoon ';x
3725 vput csop res trim-front
'Cocoon Cocoon';x
3726 vput csop res trim-front
' Cocoon Cocoon ';x
3727 vput csop res trim-end
'Cocoon Cocoon';x
3728 vput csop res trim-end
' Cocoon Cocoon ';x
3731 check
1 0 "${MBOX}" '1892119538 755'
3739 if have_feat cmd-vexpr
; then :; else
3740 t_echoskip
'[!CMD_VEXPR]'
3745 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
3746 commandalias x
echo '$?/$^ERRNAME $res'
3748 vput vexpr res
= 9223372036854775807;x
3749 vput vexpr res
= 9223372036854775808;x
3750 vput vexpr res
= u9223372036854775808
;x
3751 vput vexpr res
=?
9223372036854775808;x
3752 vput vexpr res
= -9223372036854775808;x
3753 vput vexpr res
= -9223372036854775809;x
3754 vput vexpr res
=?saturated
-9223372036854775809;x
3755 vput vexpr res
= U9223372036854775809
;x
3758 0b0111111111111111111111111111111111111111111111111111111111111111
;x
3760 S0b1000000000000000000000000000000000000000000000000000000000000000
;x
3762 S0b1000000000000000000000000000000000000000000000000000000000000000
;x
3764 U0b1000000000000000000000000000000000000000000000000000000000000000
;x
3766 0b1000000000000000000000000000000000000000000000000000000000000000
;x
3768 0b1000000000000000000000000000000000000000000000000000000000000000
;x
3770 -0b1000000000000000000000000000000000000000000000000000000000000000;x
3772 S0b1000000000000000000000000000000000000000000000000000000000000001
;x
3774 S0b1000000000000000000000000000000000000000000000000000000000000001
;x
3776 -0b1000000000000000000000000000000000000000000000000000000000000001;x
3778 U0b1000000000000000000000000000000000000000000000000000000000000001
;x
3780 vput vexpr res
= 0777777777777777777777;x
3781 vput vexpr res
= S01000000000000000000000
;x
3782 vput vexpr res
=? S01000000000000000000000
;x
3783 vput vexpr res
= U01000000000000000000000
;x
3784 vput vexpr res
= 01000000000000000000000;x
3785 vput vexpr res
=?satur
01000000000000000000000;x
3786 vput vexpr res
= -01000000000000000000000;x
3787 vput vexpr res
= S01000000000000000000001
;x
3788 vput vexpr res
=?sat S01000000000000000000001
;x
3789 vput vexpr res
= -01000000000000000000001;x
3790 vput vexpr res
= U01000000000000000000001
;x
3792 vput vexpr res
= 0x7FFFFFFFFFFFFFFF;x
3793 vput vexpr res
= S0x8000000000000000
;x
3794 vput vexpr res
=? S0x8000000000000000
;x
3795 vput vexpr res
= U0x8000000000000000
;x
3796 vput vexpr res
= 0x8000000000000000;x
3797 vput vexpr res
=?
0x8000000000000000;x
3798 vput vexpr res
= -0x8000000000000000;x
3799 vput vexpr res
= S0x8000000000000001
;x
3800 vput vexpr res
=? S0x8000000000000001
;x
3801 vput vexpr res
= -0x8000000000000001;x
3802 vput vexpr res
= u0x8000000000000001
;x
3803 vput vexpr res
= 9223372036854775809;x
3804 vput vexpr res
=?
9223372036854775809;x
3805 vput vexpr res
= u9223372036854775809
;x
3807 vput vexpr res ~
0;x
3808 vput vexpr res ~
1;x
3809 vput vexpr res ~
-1;x
3811 vput vexpr res
- 0;x
3812 vput vexpr res
- 1;x
3813 vput vexpr res
- -1;x
3814 vput vexpr res
- -0xAFFE;x
3815 vput vexpr res
- 0xAFFE;x
3816 vput vexpr res
- u0x8000000000000001
;x
3817 vput vexpr res
- 0x8000000000000001;x
3818 vput vexpr res
- 0x8000000000000001;x
3819 vput vexpr res
- 9223372036854775809;x
3820 vput vexpr res
-?
9223372036854775809;x
3822 vput vexpr res
+ 0;x
3823 vput vexpr res
+ 1;x
3824 vput vexpr res
+ -1;x
3825 vput vexpr res
+ -0xAFFE;x
3826 vput vexpr res
+ 0xAFFE;x
3827 vput vexpr res
+ u0x8000000000000001
;x
3828 vput vexpr res
+ 0x8000000000000001;x
3829 vput vexpr res
+ 9223372036854775809;x
3830 vput vexpr res
+?
9223372036854775809;x
3832 vput vexpr res
+ 0 0;x
3833 vput vexpr res
+ 0 1;x
3834 vput vexpr res
+ 1 1;x
3836 vput vexpr res
+ 9223372036854775807 0;x
3837 vput vexpr res
+ 9223372036854775807 1;x
3838 vput vexpr res
+?
9223372036854775807 1;x
3839 vput vexpr res
+ 0 9223372036854775807;x
3840 vput vexpr res
+ 1 9223372036854775807;x
3841 vput vexpr res
+?
1 9223372036854775807;x
3843 vput vexpr res
+ -9223372036854775808 0;x
3844 vput vexpr res
+ -9223372036854775808 -1;x
3845 vput vexpr res
+?
-9223372036854775808 -1;x
3846 vput vexpr res
+ 0 -9223372036854775808;x
3847 vput vexpr res
+ -1 -9223372036854775808;x
3848 vput vexpr res
+?
-1 -9223372036854775808;x
3850 vput vexpr res
- 0 0;x
3851 vput vexpr res
- 0 1;x
3852 vput vexpr res
- 1 1;x
3854 vput vexpr res
- 9223372036854775807 0;x
3855 vput vexpr res
- 9223372036854775807 -1;x
3856 vput vexpr res
-?
9223372036854775807 -1;x
3857 vput vexpr res
- 0 9223372036854775807;x
3858 vput vexpr res
- -1 9223372036854775807;x
3859 vput vexpr res
- -2 9223372036854775807;x
3860 vput vexpr res
-?
-2 9223372036854775807;x
3862 vput vexpr res
- -9223372036854775808 +0;x
3863 vput vexpr res
- -9223372036854775808 +1;x
3864 vput vexpr res
-?
-9223372036854775808 +1;x
3865 vput vexpr res
- 0 -9223372036854775808;x
3866 vput vexpr res
- +1 -9223372036854775808;x
3867 vput vexpr res
-?
+1 -9223372036854775808;x
3869 vput vexpr res
+ -13 -2;x
3870 vput vexpr res
- 0 0;x
3871 vput vexpr res
- 0 1;x
3872 vput vexpr res
- 1 1;x
3873 vput vexpr res
- -13 -2;x
3875 vput vexpr res
* 0 0;x
3876 vput vexpr res
* 0 1;x
3877 vput vexpr res
* 1 1;x
3878 vput vexpr res
* -13 -2;x
3880 vput vexpr res
/ 0 0;x
3881 vput vexpr res
/ 0 1;x
3882 vput vexpr res
/ 1 1;x
3883 vput vexpr res
/ -13 -2;x
3885 vput vexpr res
% 0 0;x
3886 vput vexpr res
% 0 1;x
3887 vput vexpr res
% 1 1;x
3888 vput vexpr res
% -13 -2;x
3890 vput vexpr res pbase
10 u0x8000000000000001
;x
3891 vput vexpr res pbase
16 0x8000000000000001;x
3892 vput vexpr res pbase
16 s0x8000000000000001
;x
3893 vput vexpr res pbase
16 u0x8000000000000001
;x
3894 vput vexpr res pbase
36 0x8000000000000001;x
3895 vput vexpr res pbase
36 u0x8000000000000001
;x
3898 check numeric
0 "${MBOX}" '163128733 2519'
3900 if have_feat regex
; then
3901 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3902 commandalias x echo '$?/$^ERRNAME :$res:'
3904 vput vexpr res regex you y;x
3905 vput vexpr res regex you o;x
3906 vput vexpr res regex you u;x
3907 vput vexpr res regex you yo;x
3908 vput vexpr res regex you ou;x
3909 vput vexpr res regex you you;x
3911 vput vexpr res regex you Y;x
3912 vput vexpr res regex? you Y;x
3913 vput vexpr res regex? you O;x
3914 vput vexpr res regex? you U;x
3915 vput vexpr res regex? you yO;x
3916 vput vexpr res regex? you oU;x
3917 vput vexpr res regex? you YoU;x
3919 vput vexpr res regex 'bananarama' 'nana';x
3920 vput vexpr res regex 'bananarama' 'bana';x
3921 vput vexpr res regex 'bananarama' 'Bana';x
3922 vput vexpr res regex 'bananarama' 'rama';x
3924 vput vexpr res regex? 'bananarama' 'nana';x
3925 vput vexpr res regex? 'bananarama' 'bana';x
3926 vput vexpr res regex? 'bananarama' 'Bana';x
3927 vput vexpr res regex? 'bananarama' 'rama';x
3929 vput vexpr res regex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}';x
3930 vput vexpr res regex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2';x
3931 vput vexpr res regex 'bananarama' 'Bana(.+)' '\$1\$0';x
3932 vput vexpr res regex 'bananarama' '(.+)rama' '\$1\$0';x
3934 vput vexpr res regex? 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}';x
3935 vput vexpr res regex? 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2';x
3936 vput vexpr res regex? 'bananarama' 'Bana(.+)' '\$1\$0';x
3937 vput vexpr res regex? 'bananarama' '(.+)rama' '\$1\$0';x
3939 vput vexpr res regex 'banana' '(club )?(.*)(nana)(.*)' \
3940 '\$1\${2}\$4\${3}rama';x
3941 vput vexpr res regex 'Banana' '(club )?(.*)(nana)(.*)' \
3942 '\$1\$2\${2}\$2\$4\${3}rama';x
3943 vput vexpr res regex 'Club banana' '(club )?(.*)(nana)(.*)' \
3944 '\$1\${2}\$4\${3}rama';x
3948 check regex 0 "${MBOX}" '2831099111 542'
3950 t_echoskip 'regex:[!REGEX]'
3959 if have_feat cmd-vexpr; then :; else
3960 t_echoskip '[!CMD_VEXPR]'
3965 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
3970 vput vexpr j
'&' $i 7
3976 vput vexpr j
'&' $i 7
3982 echo ! The end
for $1
3986 # Transport $?/$! up the call chain
3992 wysh
set i
=$? j
=$
! k
=$^ERRNAME
3996 echo ! The end
for $1
3997 return $i $^ERR-BUSY
4001 # Up and down it goes
4008 vput vexpr k
- $1 $2
4012 echo "# <$i/$j> .. "
4016 eval echon
"<\$1=\$i/\$^ERRNAME-$j "
4019 echo ! The end
for $1=$i/$2
4023 return $i $^ERR-BUSY
4029 call w1
0; echo ?
=$?
!=$
!; echo -----;
4030 call w2
0; echo ?
=$?
!=$^ERRNAME
; echo -----;
4031 call w3
0 1; echo ?
=$?
!=$^ERRNAME
; echo -----;
4034 check
1 0 "${MBOX}" '1572045517 5922'
4042 if have_feat cmd-vexpr
; then :; else
4043 t_echoskip
'[!CMD_VEXPR]'
4048 ${cat} <<- '__EOT' | \
4049 ${MAILX} ${ARGS} -Snomemdebug \
4050 -Smax=${LOOPS_MAX} \
4055 if [ $i -le "$max" ]
4056 vput vexpr j '&' $i 7
4062 echo ! The end for $1/$2
4064 return $i $^ERR-BUSY
4075 echo ?=$? !=$^ERRNAME
4078 echo ?=$? !=$^ERRNAME
4080 echo ?=$? !=$^ERRNAME
4084 if [ ${LOOPS_MAX} -eq ${LOOPS_BIG} ]; then
4085 check_ex0 1-${LOOPS_BIG} ${i}
4086 check
1-${LOOPS_BIG} - "${MBOX}" '1069764187 47161'
4088 check_ex0
1-${LOOPS_SMALL} ${i}
4089 check
1-${LOOPS_SMALL} - "${MBOX}" '859201011 3894'
4094 if have_feat uistrings
; then
4095 ${cat} <<- '__EOT' > "${BODY}"
4100 vput vexpr j '&' $i 7
4106 echo ! The end for $1
4109 echo would be err with errexit
4118 echo zwei, ?=$? !=$!
4119 localopts yes; set errexit
4121 echo drei, ?=$? !=$^ERRNAME
4123 echo vier, ?=$? !=$^ERRNAME, this is an error
4126 echo outer 1, ?=$? !=$^ERRNAME
4128 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
4130 echo outer 3, ?=$? !=$^ERRNAME
4131 echo this is definitely an error
4134 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' \
4135 -Snomemdebug > "${MBOX}" 2>&1
4136 check 2 0 "${MBOX}" '4036613316 4184'
4138 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' \
4139 -Snomemdebug > "${MBOX}" 2>&1
4140 check 3 1 "${MBOX}" '3179757785 2787'
4142 t_echoskip '2-3:[!UISTRINGS]'
4151 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
4152 vpospar set hey, "'you ", world!
4153 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4154 vput vpospar x quote; echo x<$x>
4155 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4156 vput vpospar y quote;echo y<$y>
4157 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4158 eval vpospar set ${y};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4159 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4162 echo infun2:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
4163 vput vpospar z quote;echo infun2:z<$z>
4167 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
4168 vput vpospar y quote;echo infun:y<$y>
4169 eval vpospar set ${x};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
4170 vpospar clear;echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
4172 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
4173 eval vpospar set ${y};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
4176 call infun This "in a" fun
4177 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4178 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4180 check 1 0 "${MBOX}" '155175639 866'
4183 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
4185 echo ifs<$ifs> ifs-ws<$ifs-ws>
4186 vpospar set hey, "'you ", world!
4187 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4188 vput vpospar x quote; echo x<$x>
4189 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4190 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4193 echo ifs<$ifs> ifs-ws<$ifs-ws>
4194 vpospar set hey, "'you ", world!
4195 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4197 vput vpospar x quote; echo x<$x>
4198 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4199 eval vpospar set ${x};\
4200 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4203 echo ifs<$ifs> ifs-ws<$ifs-ws>
4204 vpospar set hey, "'you ", world!
4205 unset ifs; echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4207 vput vpospar x quote; echo x<$x>
4208 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4209 eval vpospar set ${x};\
4210 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4212 check ifs 0 "${MBOX}" '2015927702 706'
4220 ${cat} > ./.t.sh <<- '___'; ${cat} > ./.t.rc <<- '___'
4223 printf " (1/$#: <$1>)"
4225 if [ $# -gt 0 ]; then
4239 printf yyy;yyy 'xxx' "b\$'\t'u ' "
4240 printf xxx;xxx arg ,b u.
4241 printf xxx;xxx arg , .
4242 printf xxx;xxx arg ,ball.
4248 echon " (1/$#: <$1>)"
4263 echon yyy;call yyy '\call xxx' "b\$'\t'u ' "
4264 echon xxx;call xxx arg ,b u.
4265 echon xxx;call xxx arg , .
4266 echon xxx;call xxx arg ,ball.
4269 ${MAILX} ${ARGS} -X'source ./.t.rc' -Xx > "${MBOX}" 2>&1
4270 check 1 0 "${MBOX}" '41566293 164'
4272 #${SHELL} ./.t.sh > ./.tshout 2>&1
4273 #check disproof-1 0 ./.tshout '41566293 164'
4281 ${cat} <<- '__EOT' > .tin
4282 hey1, "'you ", world!
4283 hey2, "'you ", bugs bunny!
4288 ${cat} <<- '__EOT' |\
4289 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
4290 commandalias x echo '$?/$^ERRNAME / <$a><$b><$c>'
4295 unset a b c;read a b c;x
4296 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
4298 check 1 0 "${MBOX}" '1527910147 173'
4300 ${cat} <<- '__EOT' > .tin2
4301 hey2.0,:"'you ",:world!:mars.:
4302 hey2.1,:"'you ",:world!
4303 hey2.2,:"'you ",:bugs bunny!
4309 ${cat} <<- '__EOT' |\
4310 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
4311 commandalias x echo '$?/$^ERRNAME / <$a><$b><$c>'
4319 unset a b c;read a b c;x
4321 readctl remove 6;echo readctl remove:$?/$^ERRNAME
4323 check ifs 0 "${MBOX}" '890153490 298'
4325 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
4326 commandalias x echo '$?/$^ERRNAME / <$d>'
4329 wysh set d;readall d;x
4330 readctl create .tin2
4332 wysh set d;readall d;x
4333 readctl remove .tin;echo $?/$^ERRNAME;\
4334 readctl remove .tin2;echo $?/$^ERRNAME
4335 echo '### now with empty lines'
4336 ! printf 'one line\n\ntwo line\n\n' > ./.temptynl
4337 readctl create .temptynl;echo $?/$^ERRNAME
4339 readctl remove .temptynl;echo $?/$^ERRNAME
4341 check readall 0 "${MBOX}" '4113506527 405'
4346 t_readsh() { # TODO not enough
4349 ${cat} <<- '__EOT' > .tin
4350 from@exam.ple ' diet spliced <from@exam.ple> ' 'a'
4351 from@exam.ple ' diet spliced <from@exam.ple> ' 'a'
4352 from@exam.ple ' diet spliced <from@exam.ple> ''a'
4353 from@exam.ple' diet spliced <from@exam.ple> ''a'
4356 ${cat} <<- '__EOT' |\
4357 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
4358 commandalias x echo '$?/$^ERRNAME / <$a><$b><$c>'
4363 unset a b c;read a b c;x
4364 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
4366 check 1 0 "${MBOX}" '2955084684 291'
4374 t__x1_msg > ./.tmbox
4377 </dev/null ${MAILX} ${ARGS} -Rf -Y '# Do not care much on error UISTRINGS
4380 \echo --- $?/$^ERRNAME, 2
4382 \echo --- $?/$^ERRNAME, 3
4383 \if "$features" !% +uistrings,
4384 \echoerr reproducible_build: Invalid field name cannot be ignored: ba:l
4386 \headerpick type ignore \
4387 from_ mail-followup-to in-reply-to DATE MESSAGE-ID STATUS ba:l
4388 \echo --- $?/$^ERRNAME, 4
4389 \if "$features" !% +uistrings,
4390 \echo "#headerpick type retain currently covers no fields"
4393 \echo --- $?/$^ERRNAME, 5
4395 \echo --- $?/$^ERRNAME, 6
4396 \unheaderpick type ignore from_ DATE STATUS
4397 \echo --- $?/$^ERRNAME, 7
4398 \if "$features" !% +uistrings,
4399 \echo "#headerpick type retain currently covers no fields"
4402 \echo --- $?/$^ERRNAME, 8
4404 \echo --- $?/$^ERRNAME, 9
4405 \if "$features" =% +uistrings,
4406 \unheaderpick type ignore from_ ba:l
4407 \wysh set x=$? y=$^ERRNAME
4409 \echoerr reproducible_build: Field not ignored: from_
4410 \echoerr reproducible_build: Field not ignored: ba:l
4414 \unheaderpick type ignore *
4415 \echo --- $?/$^ERRNAME, 11
4416 \if "$features" !% +uistrings,
4417 \echo "#headerpick type retain currently covers no fields"
4418 \echo "#headerpick type ignore currently covers no fields"
4421 \echo --- $?/$^ERRNAME, 12
4423 \echo --- $?/$^ERRNAME, 13 ---
4424 # ' ./.tmbox >./.tall 2>&1
4425 check 1 0 ./.tall '2481904228 2273'
4428 if have_feat uistrings; then
4429 have_feat regex && i='3515512395 2378' || i='4201290332 2378'
4430 </dev/null ${MAILX} ${ARGS} -Y '#
4431 \headerpick type retain \
4432 bcc cc date from sender subject to \
4433 message-id mail-followup-to reply-to user-agent
4434 \echo --- $?/$^ERRNAME, 1
4435 \headerpick forward retain \
4436 cc date from message-id list-id sender subject to \
4437 mail-followup-to reply-to
4438 \echo --- $?/$^ERRNAME, 2
4439 \headerpick save ignore ^Original-.*$ ^X-.*$ ^DKIM.*$
4440 \echo --- $?/$^ERRNAME, 3
4441 \headerpick top retain To Cc
4442 \echo --- $?/$^ERRNAME, 4 ---
4444 \echo --- $?/$^ERRNAME, 5
4446 \echo --- $?/$^ERRNAME, 6
4448 \echo --- $?/$^ERRNAME, 7
4450 \echo --- $?/$^ERRNAME, 8
4452 \echo --- $?/$^ERRNAME, 9 ---
4453 \unheaderpick type retain message-id mail-followup-to reply-to user-agent
4454 \echo --- $?/$^ERRNAME, 10
4455 \unheaderpick save ignore ^X-.*$ ^DKIM.*$
4456 \echo --- $?/$^ERRNAME, 11
4457 \unheaderpick forward retain *
4458 \echo --- $?/$^ERRNAME, 12 ---
4460 \echo --- $?/$^ERRNAME, 13
4462 \echo --- $?/$^ERRNAME, 14
4464 \echo --- $?/$^ERRNAME, 15 --
4465 \unheaderpick type retain *
4466 \echo --- $?/$^ERRNAME, 16
4467 \unheaderpick forward retain *
4468 \echo --- $?/$^ERRNAME, 17
4469 \unheaderpick save ignore *
4470 \echo --- $?/$^ERRNAME, 18
4471 \unheaderpick top retain *
4472 \echo --- $?/$^ERRNAME, 19 --
4474 \echo --- $?/$^ERRNAME, 20
4476 check 2 0 ./.tall "${i}"
4478 t_echoskip '2:[!UISTRINGS]'
4485 # Send/RFC absolute basics {{{
4486 t_can_send_rfc() { # {{{
4489 </dev/null ${MAILX} ${ARGS} -Smta=test://"$MBOX" -s Sub.1 \
4492 check 1 0 "${MBOX}" '550126528 126'
4493 check 1-err - .terr
'4294967295 0'
4495 </dev
/null
${MAILX} ${ARGS} -Smta=test://"$MBOX" -s Sub
.2 \
4496 -b bcc@no
.1 -b bcc@no
.2 -b bcc@no
.3 \
4497 -c cc@no
.1 -c cc@no
.2 -c cc@no
.3 \
4498 to@no
.1 to@no
.2 to@no
.3 \
4500 check
2 0 "${MBOX}" '3259888945 324'
4501 check
2-err - .terr
'4294967295 0'
4503 </dev
/null
${MAILX} ${ARGS} -Smta=test://"$MBOX" -s Sub
.2no \
4504 -b bcc@no
.1\ \ bcc@no
.2 -b bcc@no
.3 \
4505 -c cc@no
.1,cc@no
.2 -c cc@no
.3 \
4506 to@no
.1,to@no
.2 to@no
.3 \
4508 check
2no
4 "${MBOX}" '3350946897 468'
4509 if have_feat uistrings
; then
4510 check
2no-err
- .terr
'3397557940 190'
4512 check
2no-err
- .terr
'4294967295 0'
4515 # XXX NOTE we cannot test "cc@no1 <cc@no.2>" because our stupid parser
4516 # XXX would not treat that as a list but look for "," as a separator
4517 </dev
/null
${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sfullnames -s Sub
.3 \
4518 -T 'bcc?single: bcc@no.1, <bcc@no.2>' -T bcc
:\ bcc@no
.3 \
4519 -T cc?si\ \
:\ \
'cc@no.1, <cc@no.2>' -T cc
:\ cc@no
.3 \
4520 -T to?
:\ to@no
.1,'<to@no.2>' -T to
:\ to@no
.3 \
4522 check
3 0 "${MBOX}" '1453534480 678'
4523 check
3-err - .terr
'4294967295 0'
4525 </dev
/null
${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sfullnames -s Sub
.4 \
4526 -T 'bcc: bcc@no.1, <bcc@no.2>' -T bcc
:\ bcc@no
.3 \
4527 -T cc
:\
'cc@no.1, <cc@no.2>' -T cc\ \
:\ \ cc@no
.3 \
4528 -T to\
:to@no
.1,'<to@no.2>' -T to
:\ to@no
.3 \
4530 check
4 0 "${MBOX}" '535767201 882'
4531 check
4-err - .terr
'4294967295 0'
4533 # Two test with a file-based MTA
4534 "${cat}" <<-_EOT > .tmta.sh
4536 (echo 'From reproducible_build Wed Oct 2 01:50:07 1996' &&
4537 "${cat}" && echo pardauz && echo) > "${MBOX}"
4539 ${chmod} 0755 .tmta.sh
4541 </dev
/null
${MAILX} ${ARGS} -Smta=.
/.tmta.sh
-s Sub.mta-1 \
4542 receiver@number
.1 > .
/.terr
2>&1
4543 check
5 0 "${MBOX}" '2384401657 138'
4544 check
5-err - .terr
'4294967295 0'
4546 </dev
/null
${MAILX} ${ARGS} -Smta=file://.
/.tmta.sh
-s Sub.mta-2 \
4547 receiver@number
.1 > .
/.terr
2>&1
4548 check
6 0 "${MBOX}" '3006460737 138'
4549 check
6-err - .terr
'4294967295 0'
4552 </dev
/null
${MAILX} ${ARGS} -Smta=test \
4561 check
7 0 .
/.tall
'951018449 138'
4563 ## *record*, *outfolder*, with and without *mta-bcc-ok*
4565 xfolder
=`${pwd}`/.tfolder
4567 "${cat}" <<-_EOT > .tmta.sh
4569 (echo 'From reproducible_build Wed Oct 2 01:50:07 1996' &&
4570 "${cat}" && echo 'ARGS: '"\${@}" && echo) > "${MBOX}"
4572 ${chmod} 0755 .tmta.sh
4575 </dev
/null
${MAILX} ${ARGS} -Smta=./.tmta.sh -Sfolder="${xfolder}" \
4578 -b bcc@no.1 -b bcc@no.2 -b bcc@no.3 \
4579 -c cc@no.1 -c cc@no.2 -c cc@no.3 \
4580 to@no.1 to@no.2 to@no.3 \
4581 receiver@number.1 > ./.terr 2>&1
4586 check 8 0 "${MBOX}" '1365032629 292'
4587 check 8-1 - .terr '4294967295 0'
4589 t_it -Snomta-bcc-ok -Srecord=.trec9
4590 check 9 0 "${MBOX}" '1365032629 292'
4591 check 9-1 - .terr '4294967295 0'
4592 check 9-2 - ./.trec9 '160206230 221'
4594 t_it -Srecord=.trec10
4595 check 10 0 "${MBOX}" '3085765596 326'
4596 check 10-1 - .terr '4294967295 0'
4597 check 10-2 - ./.trec10 '160206230 221'
4599 t_it -Snomta-bcc-ok -Srecord=.trec11 -Soutfolder
4600 check 11 0 "${MBOX}" '1365032629 292'
4601 check 11-1 - .terr '4294967295 0'
4602 check 11-2 - ./.tfolder/.trec11 '160206230 221'
4603 # That is appends to an MBOX
4604 t_it -Srecord=.trec11 -Soutfolder
4605 check 12 0 "${MBOX}" '3085765596 326'
4606 check 12-1 - .terr '4294967295 0'
4607 check 12-2 - ./.tfolder/.trec11 '1618754846 442'
4611 ## From: and Sender:
4612 </dev/null ${MAILX} ${ARGS} -s ubject \
4613 -S from=a@b.org,b@b.org,c@c.org -S sender=a@b.org \
4614 to@exam.ple > "${MBOX}" 2>&1
4615 check 13 0 "${MBOX}" '143390417 169'
4617 # ..if From: is single mailbox and Sender: is same, no Sender:
4618 </dev/null ${MAILX} ${ARGS} -s ubject \
4619 -S from=a@b.org -S sender=a@b.org \
4620 to@exam.ple > "${MBOX}" 2>&1
4621 check 14 0 "${MBOX}" '1604962737 135'
4627 # Alternates and ML related address massage etc. somewhere else
4629 XARGS=${ARGS} # TODO v15-compat
4630 ARGS="${ARGS} -Sv15-compat=y
"
4632 t__gen_msg subject reply from 1 to 2 cc 2 > "${MBOX}"
4634 ## Base (does not test "recipient record
")
4636 </dev/null ${MAILX} ${ARGS} -Rf \
4641 set fullnames escape=!; '${1}'
4645 set recipients-in-cc nofullnames; '${1}'
4649 unset recipients-in-cc; '${1}'
4654 "${MBOX}" > ./.tall 2>&1
4659 check 1 0 ./.tall '4164251531 851'
4661 check 2 0 ./.tall '3034955332 591'
4662 t_it reply 'set flipr;'
4663 check 3 0 ./.tall '3034955332 591'
4664 t_it Reply 'set flipr;'
4665 check 4 0 ./.tall '4164251531 851'
4668 t__gen_msg subject reply-no-addr > ./.tnoaddr
4670 # MBOX will deduce addressee from From_ line..
4671 </dev/null ${MAILX} ${ARGS} -R -Sescape=! \
4673 File ./.tnoaddr; reply # Takes addressee from From_ line :(
4677 File '"${MBOX}"'; set ea=$expandaddr expandaddr=-all; reply
4680 echo 2:$?/$^ERRNAME; set expandaddr=$ea; reply 10 # BADMSG
4681 echo 3:$?/$^ERRNAME; reply # cannot test IO,NOTSUP,INVAL
4687 check 5 0 ./.tall '3088217220 382'
4688 if have_feat uistrings; then
4689 check 6 - ./.terr '2514745519 544'
4691 t_echoskip '6:[!UISTRINGS]'
4694 # ..but Maildir will not
4695 if have_feat maildir; then
4696 ${mkdir} -p .tdir .tdir/tmp .tdir/cur .tdir/new
4697 ${sed} 1d < ./.tnoaddr > .tdir/new/sillyname
4699 </dev/null ${MAILX} ${ARGS} -R -Sescape=! \
4705 File '"${MBOX}"'; set ea=$expandaddr expandaddr=-all; reply
4708 echo 2:$?/$^ERRNAME; set expandaddr=$ea; reply 10 # BADMSG
4709 echo 3:$?/$^ERRNAME;reply # cannot test IO,NOTSUP,INVAL
4715 check 7 0 ./.tall '3631170341 244'
4716 if have_feat uistrings; then
4717 check 8 - ./.terr '1074346767 629'
4719 t_echoskip '8:[!UISTRINGS]'
4723 ## Ensure action on multiple messages
4724 t__gen_msg subject reply2 from from2@exam.ple body body2 >> "${MBOX}"
4727 </dev/null ${MAILX} ${ARGS} -Rf -Sescape=! \
4734 echo 1:$?/$^ERRNAME; '${2}' 1 2
4739 "${MBOX}" > ./.tall 2>&1
4740 check ${3} 0 ./.tall '283309820 502'
4741 if [ ${#} -eq 4 ]; then
4743 check ${3}-1 - ./.tlst '1649520021 12'
4744 check ${3}-2 - ./from1 '1501109193 347'
4745 check ${3}-3 - ./from2 '2154231432 137'
4750 t_it respond Respond 10
4751 t_it followup Followup 11 yes
4752 ${rm} -f from1 from2
4754 ## *record*, *outfolder* (reuses $MBOX)
4758 </dev/null ${MAILX} ${ARGS} -Rf -Sescape=! -Sfolder=`${pwd}`/.tfolder \
4765 echo 1:$?/$^ERRNAME; '${2}' 1 2
4768 echo 2:$?/$^ERRNAME; set record=.trec'${4}'; '${1}' 1 2
4773 echo 3:$?/$^ERRNAME; '${2}' 1 2
4776 echo 4:$?/$^ERRNAME; set outfolder norecord
4782 echo 1:$?/$^ERRNAME; '${2}' 1 2
4785 echo 2:$?/$^ERRNAME; set record=.trec'${4}'; '${1}' 1 2
4790 echo 3:$?/$^ERRNAME; '${2}' 1 2
4795 "${MBOX}" > ./.tall 2>&1
4796 check ${3} 0 ./.tall '3410330303 2008'
4797 if [ ${#} -ne 5 ]; then
4798 check ${4} - ./.trec${4} '3044885336 484'
4799 check ${4}-1 - ./.tfolder/.trec${4} '3044885336 484'
4801 [ -f ./.trec${4} ]; check_exn0 ${4}
4803 check ${4}-1 - ./.tlst '1649520021 12'
4804 check ${4}-2 - ./from1 '2668975631 694'
4805 check ${4}-3 - ./from2 '225462887 274'
4806 [ -f ./.tfolder/.trec${4} ]; check_exn0 ${4}-4
4807 ( cd .tfolder && echo * > ./.tlst )
4808 check ${4}-5 - ./.tfolder/.tlst '1649520021 12'
4809 check ${4}-6 - ./.tfolder/from1 '2668975631 694'
4810 check ${4}-7 - ./.tfolder/from2 '225462887 274'
4814 t_it reply Reply 12 13
4815 t_it respond Respond 14 15
4816 t_it followup Followup 16 17 yes
4817 #${rm} -f from1 from2
4819 ## Quoting (if not cmd_escapes related)
4821 t__x2_msg > ./.tmbox
4824 set indentprefix=" |
" quote
4828 set quote=noheading quote-inject-head
4832 headerpick type retain cc date from message-id reply-to subject to
4837 set quote=allheaders
4841 set quote-inject-head=%% quote-inject-tail=%% quote=headers
4846 quote-inject-head='"\$
'"'\\
4847 (%%%%a
=%%a
%%%%d
=%%d
%%%%f
=%%f
%%%%i
=%%i
%%%%n
=%%n
%%%%r
=%%r
)\\
4849 quote-inject-tail='"\$
'"'\\
4850 (%%%%a
=%%a
%%%%d
=%%d
%%%%f
=%%f
%%%%i
=%%i
%%%%n
=%%n
%%%%r
=%%r
)\\
4855 set showname datefield=%%y nodatefield-markout-older indentprefix=\\ :
4859 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Rf \
4860 -Sescape=! -Sindentprefix=' >' \
4861 ./.tmbox >./.tall 2>&1
4863 ${cat} ./.tall >> "${MBOX}"
4864 check 18 - "${MBOX}" '385267528 3926'
4866 # quote-as-attachment, fullnames
4867 </dev/null ${MAILX} ${ARGS} -Rf \
4869 -S quote-as-attachment \
4870 -Y reply -Y yb1 -Y !. \
4871 -Y 'unset quote-as-attachment' \
4872 -Y 'reply;yb2' -Y !. \
4873 -Y 'set quote-as-attachment fullnames' \
4874 -Y ';reply;yb3' -Y !. \
4875 ./.tmbox >./.tall 2>&1
4876 check 19 0 ./.tall '2774517283 2571'
4878 # Moreover, quoting of several parts with all*
4879 t__gen_mimemsg from 'ex1@am.ple' subject for-repl > ./.tmbox
4880 check 20 0 ./.tmbox '1874764424 668'
4882 </dev/null ${MAILX} ${ARGS} -Rf \
4883 -Sescape=! -Sindentprefix=' |' \
4884 -Y 'set quote=allheaders' \
4886 -Y 'set quote=allbodies' \
4889 ./.tmbox >./.tall 2>&1
4890 check 21 0 ./.tall '946925637 1105'
4892 ARGS=${XARGS} # TODO v15-compat
4899 ARGS="${ARGS} -Sv15-compat=y
"
4901 t__gen_msg subject fwd1 body origb1 from 1 to 2 > "${MBOX}"
4902 t__gen_msg subject fwd2 body origb2 from 1 to 1 >> "${MBOX}"
4904 ## Base (does not test "recipient record
")
4906 </dev/null ${MAILX} ${ARGS} -Rf \
4907 -Y ${1}' . "du
<ex1@am.ple
>"
4910 echo 1:$?/$^ERRNAME; echoerr 1:done
4911 set fullnames escape=!
4912 '${1}' 1 "du
<ex2@am.ple
>"
4915 echo 2:$?/$^ERRNAME; echoerr 2:done
4917 set nofullnames ea=$expandaddr expandaddr=-all
4918 '${1}' ` "du
<ex3@am.ple
>"
4921 echo 3:$?/$^ERRNAME; echoerr 3:done
4923 '${1}' ` ex4-nono@am.ple ex4@am.ple # the first is a non-match msglist
4926 echo 4:$?/$^ERRNAME; echoerr 4:done
4927 '${1}' # TODO not yet possible b5 !.
4928 echo 5:$?/$^ERRNAME; echoerr 5:done
4930 '${1}' 1 2 ex6@am.ple
4935 echo 6:$?/$^ERRNAME; echoerr 6:done
4936 set forward-add-cc fullnames
4940 echo 7:$?/$^ERRNAME; echoerr 7:done
4945 echo 8:$?/$^ERRNAME; echoerr 8:done
4947 "${MBOX}" > ./.tall 2>./.terr
4952 check 1 0 ./.tall '2356713156 2219'
4953 if have_feat uistrings && have_feat docstrings; then
4954 check 2 - ./.terr '3273108824 335'
4956 t_echoskip '2:[!UISTRINGS]'
4960 check 3 0 ./.tall '2356713156 2219'
4961 if have_feat uistrings && have_feat docstrings; then
4962 check 4 - ./.terr '447176534 355'
4964 t_echoskip '4:[!UISTRINGS]'
4968 ## *record*, *outfolder* (reuses $MBOX)
4972 </dev/null ${MAILX} ${ARGS} -Rf -Sescape=! -Sfolder=`${pwd}`/.tfolder \
4977 echo 1:$?/$^ERRNAME; set record=.trec'${2}'; '${1}' 1 ex2@am.ple
4980 echo 2:$?/$^ERRNAME; set outfolder norecord; '${1}' 2 ex1@am.ple
4983 echo 3:$?/$^ERRNAME; set record=.trec'${2}'; '${1}' 2 ex2@am.ple
4988 "${MBOX}" > ./.tall 2>&1
4989 check ${2} 0 ./.tall '3180366037 1212'
4990 if [ ${#} -ne 4 ]; then
4991 check ${3}-1 - ./.trec${2} '1769129556 304'
4992 check ${3}-2 - ./.tfolder/.trec${2} '2335391111 284'
4994 [ -f ./.trec${2} ]; check_exn0 ${3}
4996 check ${3}-1 - ./.tlst '2020171298 8'
4997 check ${3}-2 - ./ex1 '1512529673 304'
4998 check ${3}-3 - ./ex2 '1769129556 304'
4999 [ -f ./.tfolder/.trec${2} ]; check_exn0 ${3}-4
5000 ( cd .tfolder && echo * > ./.tlst )
5001 check ${3}-5 - ./.tfolder/.tlst '2020171298 8'
5002 check ${3}-6 - ./.tfolder/ex1 '2016773910 284'
5003 check ${3}-7 - ./.tfolder/ex2 '2335391111 284'
5008 t_it Forward 7 8 yes
5011 ## Injections, headerpick selection
5013 t__x2_msg > ./.tmbox
5016 set quote=noheading forward-inject-head
5017 forward 1 ex1@am.ple
5020 headerpick forward retain cc from subject to
5021 forward 1 ex1@am.ple
5024 unheaderpick forward retain *
5025 forward 1 ex1@am.ple
5028 headerpick forward ignore in-reply-to reply-to message-id status
5029 set forward-inject-head=%% forward-inject-tail=%%
5030 forward 1 ex1@am.ple
5033 set forward-inject-head='"\$
'"'\\
5034 (%%%%a
=%%a
%%%%d
=%%d
%%%%f
=%%f
%%%%i
=%%i
%%%%n
=%%n
%%%%r
=%%r
)\\
5036 forward-inject-tail='"\$
'"'\\
5037 (%%%%a
=%%a
%%%%d
=%%d
%%%%f
=%%f
%%%%i
=%%i
%%%%n
=%%n
%%%%r
=%%r
)\\
5039 forward 1 ex1@am.ple
5042 set showname datefield=%%y nodatefield-markout-older
5043 forward 1 ex1@am.ple
5046 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Rf \
5048 ./.tmbox >./.tall 2>&1
5050 ${cat} ./.tall >> "${MBOX}"
5051 check 9 - "${MBOX}" '2976943913 2916'
5053 # forward-as-attachment
5054 </dev/null ${MAILX} ${ARGS} -Rf \
5056 -S forward-inject-head=.head. \
5057 -S forward-inject-tail=.tail. \
5058 -S forward-as-attachment \
5059 -Y 'headerpick forward retain subject to from' \
5060 -Y 'forward ex1@am.ple' -Y b1 -Y !. \
5061 -Y 'unset forward-as-attachment' \
5062 -Y 'forward ex1@am.ple;b2' -Y !. \
5063 ./.tmbox >./.tall 2>&1
5064 check 10 0 ./.tall '799103633 1250'
5073 ARGS="${ARGS} -Sv15-compat=y
"
5075 t__gen_msg subject fwd1 body origb1 from 1 to 2 > "${MBOX}"
5076 t__gen_msg subject fwd2 body origb2 from 1 to 1 >> "${MBOX}"
5080 </dev/null ${MAILX} ${ARGS} -Rf \
5081 -Y ${1}' . "du
<ex1@am.ple
>"
5082 echo 1:$?/$^ERRNAME; echoerr 1:done
5083 set fullnames escape=!
5084 '${1}' 1 "du
, da
<ex2@am.ple
>"
5085 echo 2:$?/$^ERRNAME; echoerr 2:done
5087 set nofullnames ea=$expandaddr expandaddr=-all
5088 '${1}' ` "du
<ex3@am.ple
>"
5089 echo 3:$?/$^ERRNAME; echoerr 3:done
5091 '${1}' ` ex4-nono@am.ple ex4@am.ple # the first is a non-match msglist
5092 echo 4:$?/$^ERRNAME; echoerr 4:done
5093 '${1}' # TODO not yet possible b5 !.
5094 echo 5:$?/$^ERRNAME; echoerr 5:done
5096 '${1}' 1 2 ex6@am.ple
5097 echo 6:$?/$^ERRNAME; echoerr 6:done
5099 "${MBOX}" > ./.tall 2>./.terr
5104 check 1 0 ./.tall '1461006932 1305'
5105 if have_feat uistrings; then
5106 check 2 - ./.terr '138360532 210'
5108 t_echoskip '2:[!UISTRINGS]'
5112 check 3 0 ./.tall '3674535444 958'
5113 if have_feat uistrings; then
5114 check 4 - ./.terr '138360532 210'
5116 t_echoskip '4:[!UISTRINGS]'
5119 ## *record*, *outfolder* (reuses $MBOX)
5123 </dev/null ${MAILX} ${ARGS} -Rf -Sescape=! -Sfolder=`${pwd}`/.tfolder \
5125 set record=.trec'${2}'; '${1}' 1 ex1@am.ple
5126 echo 1:$?/$^ERRNAME; set record-resent; '${1}' 1 ex2@am.ple
5127 echo 2:$?/$^ERRNAME; set outfolder norecord-resent; '${1}' 2 ex1@am.ple
5128 echo 3:$?/$^ERRNAME; set record-resent; '${1}' 2 ex2@am.ple
5131 "${MBOX}" > ./.tall 2>&1
5133 if [ ${#} -ne 3 ]; then
5134 check ${2} - ./.tall '1711347390 992'
5135 check ${3}-1 - ./.trec${2} '2840978700 249'
5136 check ${3}-2 - ./.tfolder/.trec${2} '3219997964 229'
5138 check ${2} - ./.tall '1391418931 724'
5139 check ${3}-1 - ./.trec${2} '473817710 182'
5140 check ${3}-2 - ./.tfolder/.trec${2} '2174632404 162'
5156 t__gen_msg subject Copy1 from 1 to 1 body 'Body1' > "${MBOX}"
5157 t__gen_msg subject Copy2 from 1 to 1 body 'Body2' >> "${MBOX}"
5158 check 1 - "${MBOX}" '137107341 324' # for flag test
5161 </dev/null ${MAILX} ${ARGS} -f \
5170 copy .tf1 # no auto-advance
5179 !'"${chmod}"' 0444 .tf3
5183 "${MBOX}" > ./.tallx 2>./.terr
5186 if have_feat uistrings; then # TODO
5187 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5188 ${sed} '$d' < ./.tallx > ./.tall
5190 ${mv} ./.tallx ./.tall
5192 if [ -n "${HONOURS_READONLY}" ]; then
5193 n2_1=2-1 cs2_1='1913702840 1121'
5194 n2_4=2-4 cs2_4='3642131968 344'
5195 n2_5=2-5 cs2_5='2617612897 112'
5197 n2_1=2-1-nrdonly cs2_1='1962556153 1146'
5198 n2_4=2-4-nrdonly cs2_4='3733058190 688'
5199 n2_5=2-5-nrdonly cs2_5='3989834342 80'
5201 check ${n2_1} - ./.tall "${cs2_1}"
5202 check 2-2 - ./.tf1 '686654461 334'
5203 check 2-3 - ./.tf2 '1931512953 162'
5204 check ${n2_4} - ./.tf3 "${cs2_4}"
5205 if have_feat uistrings; then
5206 check ${n2_5} - ./.terr "${cs2_5}"
5208 t_echoskip '2-5:[!UISTRINGS]'
5212 check 3 - "${MBOX}" '1477662071 346'
5216 t__gen_msg subject Copy1 from 1 to 1 body 'Body1' > "${MBOX}"
5217 t__gen_msg subject Copy2 from 1 to 1 body 'Body2' >> "${MBOX}"
5218 t__gen_msg subject Copy3 from ex@am.ple to 1 body 'Body3' >> "${MBOX}"
5219 check ${1} - "${MBOX}" '2667292819 473' # for flag test
5221 </dev/null ${MAILX} ${ARGS} -f \
5240 "${MBOX}" > ./.tallx 2>&1
5246 if have_feat uistrings; then # TODO
5247 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5248 ${sed} '$d' < ./.tallx > ./.tall
5250 ${mv} ./.tallx ./.tall
5253 check 5-2 - ./.tlst '1058655452 9'
5254 check 5-3 - ./.tall '1543702808 1617'
5255 check 5-4 - ./from1 '1031912635 999'
5256 check 5-5 - ./ex '2400630246 149'
5257 ${rm} -f ./.tlst ./.tall ./from1 ./ex
5260 t_it 6 '#' 'set outfolder folder='"`${pwd}`"'/.tfolder'
5262 if have_feat uistrings; then # TODO
5263 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5264 ${sed} '$d' < ./.tallx > ./.tall
5266 ${mv} ./.tallx ./.tall
5268 echo * .tfolder/* > ./.tlst
5269 check 6-2 - ./.tlst '1865898363 29'
5270 ${cat} ./.tall >> ${ERR} #check 6-3 - ./.tall # TODO due to folder echoes
5271 check 6-4 - .tfolder/from1 '1031912635 999'
5272 check 6-5 - .tfolder/ex '2400630246 149'
5275 t__x2_msg > ./.tmbox
5281 headerpick save retain cc date from subject to
5284 unheaderpick save retain *
5287 headerpick save ignore status in-reply-to
5290 #' | ${MAILX} ${ARGS} -Rf ./.tmbox > ./.tall 2>&1
5296 check 7-1 - ./.tall '3805176908 152'
5297 check 7-2 - ./.tout '2447734879 1316'
5302 check 8-1 - ./.tall '1044700686 136'
5303 check 8-2 - ./mr2 '2447734879 1316'
5304 check 8-3 - ./.tlst '3190056903 4'
5312 t__gen_msg subject Save1 from 1 to 1 body 'Body1' > "${MBOX}"
5313 t__gen_msg subject Save2 from 1 to 1 body 'Body2' >> "${MBOX}"
5314 check 1 - "${MBOX}" '3634443864 324' # for flag test
5317 </dev/null ${MAILX} ${ARGS} -f \
5326 save .tf1 # no auto-advance
5335 !'"${chmod}"' 0444 .tf3
5339 "${MBOX}" > ./.tallx 2>./.terr
5342 if have_feat uistrings; then # TODO
5343 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5344 ${sed} '$d' < ./.tallx > ./.tall
5346 ${mv} ./.tallx ./.tall
5348 if [ -n "${HONOURS_READONLY}" ]; then
5349 n2_1=2-1 cs2_1='2335843514 1121'
5350 n2_4=2-4 cs2_4='970407001 344'
5351 n2_5=2-5 cs2_5='45116475 112'
5353 n2_1=2-1-nrdonly cs2_1='1736244784 1146'
5354 n2_4=2-4-nrdonly cs2_4='3903872811 688'
5355 n2_5=2-5-nrdonly cs2_5='720724138 80'
5357 check ${n2_1} - ./.tall "${cs2_1}"
5358 check 2-2 - ./.tf1 '2435434321 334'
5359 check 2-3 - ./.tf2 '920652966 162'
5360 check ${n2_4} - ./.tf3 "${cs2_4}"
5361 if have_feat uistrings; then
5362 check ${n2_5} - ./.terr "${cs2_5}"
5364 t_echoskip '2-5:[!UISTRINGS]'
5368 check 3 - "${MBOX}" '1219692400 346'
5372 t__gen_msg subject Save1 from 1 to 1 body 'Body1' > "${MBOX}"
5373 t__gen_msg subject Save2 from 1 to 1 body 'Body2' >> "${MBOX}"
5374 t__gen_msg subject Save3 from ex@am.ple to 1 body 'Body3' >> "${MBOX}"
5375 check ${1} - "${MBOX}" '1391391227 473' # for flag test
5377 </dev/null ${MAILX} ${ARGS} -f \
5396 "${MBOX}" > ./.tallx 2>&1
5402 if have_feat uistrings; then # TODO
5403 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5404 ${sed} '$d' < ./.tallx > ./.tall
5406 ${mv} ./.tallx ./.tall
5409 check 5-2 - ./.tlst '1058655452 9'
5410 check 5-3 - ./.tall '3418590770 1617'
5411 check 5-4 - ./from1 '1462882526 999'
5412 check 5-5 - ./ex '2153575326 149'
5413 ${rm} -f ./.tlst ./.tall ./from1 ./ex
5416 t_it 6 '#' 'set outfolder folder='"`${pwd}`"'/.tfolder'
5418 if have_feat uistrings; then # TODO
5419 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5420 ${sed} '$d' < ./.tallx > ./.tall
5422 ${mv} ./.tallx ./.tall
5424 echo * .tfolder/* > ./.tlst
5425 check 6-2 - ./.tlst '1865898363 29'
5426 ${cat} ./.tall >> ${ERR} #check 6-3 - ./.tall # TODO due to folder echoes
5427 check 6-4 - .tfolder/from1 '1462882526 999'
5428 check 6-5 - .tfolder/ex '2153575326 149'
5433 t__x2_msg > ./.tmbox
5434 check ${1} - ./.tmbox '561523988 397'
5437 [ ${#} -gt 2 ] && a='-S MBOX=./.tmboxx'
5438 [ ${#} -gt 3 ] && a="${a}"' -S inbox=./.tmbox'
5444 headerpick save retain cc date from subject to
5447 unheaderpick save retain *
5450 headerpick save ignore status in-reply-to
5453 #' | ${MAILX} ${ARGS} -f ${a} ./.tmbox > ./.tall 2>&1
5457 t_it 7 'save ./.tout'
5459 check 7-1 - ./.tall '4190949581 312'
5460 check 7-2 - ./.tout '2447734879 1316'
5461 check 7-3 - ./.tmbox '561523988 397'
5466 check 8-1 - ./.tall '2109832180 296'
5467 check 8-2 - ./mr2 '2447734879 1316'
5468 check 8-3 - ./.tlst '3190056903 4'
5469 check 8-3 - ./.tmbox '561523988 397'
5471 # saves in $MBOX without argument
5474 check 9-1 - ./.tall '652005824 320'
5475 check 9-2 - ./.tmboxx '2447734879 1316'
5476 check 9-3 - ./.tmbox '561523988 397'
5478 # and deletes if editing a primary mailbox
5480 t_it 10 save yes yes
5482 check 10-1 - ./.tall '652005824 320'
5483 check 10-2 - ./.tmboxx '2447734879 1316'
5484 [ -f ./.tmbox ]; check_exn0 10-3
5492 t__gen_msg subject Move1 from 1 to 1 body 'Body1' > "${MBOX}"
5493 t__gen_msg subject Move2 from 1 to 1 body 'Body2' >> "${MBOX}"
5494 check 1 - "${MBOX}" '2967134193 324' # for flag test
5497 </dev/null ${MAILX} ${ARGS} -f \
5506 !touch .tf2; '"${chmod}"' 0444 .tf2
5509 !'"${chmod}"' 0644 .tf2
5514 "${MBOX}" > ./.tallx 2>./.terr
5517 if have_feat uistrings; then # TODO
5518 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5519 ${sed} '$d' < ./.tallx > ./.tall
5521 ${mv} ./.tallx ./.tall
5523 if [ -n "${HONOURS_READONLY}" ]; then
5524 n2_1=2-1 cs2_1='1641443074 491'
5525 n2_4=2-4 cs2_4='602144474 155'
5527 n2_1=2-1-nrdonly cs2_1='3045412111 492'
5528 n2_4=2-4-nrdonly cs2_4='2197157669 201'
5530 check ${n2_1} - ./.tall "${cs2_1}"
5531 check 2-2 - ./.tf1 '1473857906 162'
5532 check 2-3 - ./.tf2 '331229810 162'
5533 if have_feat uistrings; then
5534 check ${n2_4} - ./.terr "${cs2_4}"
5536 t_echoskip '2-4:[!UISTRINGS]'
5540 check 3 - "${MBOX}" '4294967295 0'
5544 t__gen_msg subject Move1 from 1 to 1 body 'Body1' > "${MBOX}"
5545 t__gen_msg subject Move2 from 1 to 1 body 'Body2' >> "${MBOX}"
5546 t__gen_msg subject Move3 from ex@am.ple to 1 body 'Body3' >> "${MBOX}"
5547 check ${1} - "${MBOX}" '2826896131 473' # for flag test
5549 </dev/null ${MAILX} ${ARGS} -f \
5568 "${MBOX}" > ./.tallx 2>./.terr
5574 if have_feat uistrings; then # TODO
5575 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5576 ${sed} '$d' < ./.tallx > ./.tall
5578 ${mv} ./.tallx ./.tall
5581 check 5-2 - ./.tlst '1058655452 9'
5582 check 5-3 - ./.tall '419037676 870'
5583 if have_feat uistrings; then
5584 check 5-4 - ./.terr '1383646464 86'
5586 t_echoskip '5-4:[!UISTRINGS]'
5588 check 5-5 - ./from1 '3719268580 827'
5589 check 5-6 - ./ex '4262925856 149'
5590 ${rm} -f ./.tlst ./.tall ./.terr ./from1 ./ex
5593 t_it 6 '#' 'set outfolder folder='"`${pwd}`"'/.tfolder'
5595 if have_feat uistrings; then # TODO
5596 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5597 ${sed} '$d' < ./.tallx > ./.tall
5599 ${mv} ./.tallx ./.tall
5601 echo * .tfolder/* > ./.tlst
5602 check 6-2 - ./.tlst '1865898363 29'
5603 ${cat} ./.tall >> ${ERR} #check 6-3 - ./.tall # TODO due to folder echoes
5604 check 6-4 - .tfolder/from1 '3719268580 827'
5605 check 6-5 - .tfolder/ex '4262925856 149'
5608 t__x2_msg > ./.tmbox
5614 headerpick save retain cc date from subject to
5617 unheaderpick save retain *
5620 headerpick save ignore status in-reply-to
5623 #' | ${MAILX} ${ARGS} -Rf ./.tmbox > ./.tall 2>&1
5629 check 7-1 - ./.tall '3805176908 152'
5630 check 7-2 - ./.tout '2447734879 1316'
5635 check 8-1 - ./.tall '1044700686 136'
5636 check 8-2 - ./mr2 '2447734879 1316'
5637 check 8-3 - ./.tlst '3190056903 4'
5647 while [ ${i} -lt 113 ]; do
5648 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
5649 "${MBOX}" "${i}" "${i}"
5652 ) | ${MAILX} ${ARGS} > .tall 2>&1
5653 check 1 0 "${MBOX}" '1785801373 13336'
5654 check 1-outerr - ./.tall '4294967295 0' # empty file
5656 printf 'File "%s
"\ncopy * "%s
"\nFile "%s
"\nfrom*' "${MBOX}" .tmbox1 .tmbox1 |
5657 ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
5658 check 2 0 .tall '3467540956 8991'
5660 printf 'File "%s
"\ncopy * "file://%s
"\nFile "file://%s
"\nfrom*' \
5661 "${MBOX}" .tmbox2 .tmbox2 | ${MAILX} ${ARGS} -Sshowlast > .tall
2>&1
5662 check
3 0 .tall
'2410946529 8998'
5664 # copy only the odd (but the first), move the even
5666 printf 'File "file://%s"\ncopy ' .tmbox2
5668 while [ ${i} -lt 113 ]; do
5672 printf 'file://%s\nFile "file://%s"\nfrom*' .tmbox3 .tmbox3
5673 ) |
${MAILX} ${ARGS} -Sshowlast > .tall
2>&1
5674 check
4 0 .tmbox3
'2554734733 6666'
5675 check
5 - .tall
'2062382804 4517'
5678 printf 'file "file://%s"\nmove ' .tmbox2
5680 while [ ${i} -lt 113 ]; do
5684 printf 'file://%s\nFile "file://%s"\nfrom*\nFile "file://%s"\nfrom*' \
5685 .tmbox3 .tmbox3 .tmbox2
5686 ) |
${MAILX} ${ARGS} -Sshowlast > .tall 2>>${ERR}
5687 check
6 0 .tmbox3
'1429216753 13336'
5688 if have_feat uistrings
; then
5689 ${sed} 2d
< .tall
> .tallx
5693 check
7 - .tallx
'169518319 13477'
5695 # Invalid MBOXes (after [f4db93b3])
5697 printf 'copy 1 ./.tinvmbox' |
${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
5698 check 8 0 .tinvmbox '2848412822 118'
5699 check 9 - ./.tall '461280182 33'
5701 echo ' ' > .tinvmbox
5702 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall
2>&1
5703 check
10 0 .tinvmbox
'624770486 120'
5704 check
11 - .
/.tall
'461280182 33'
5706 { echo; echo; } > .tinvmbox
# (not invalid)
5707 printf 'copy 1 ./.tinvmbox' |
${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
5708 check 12 0 .tinvmbox '1485640875 119'
5709 check 13 - ./.tall '461280182 33'
5711 # *mbox-rfc4155*, plus
5712 ${cat} <<-_EOT > ./.tinv1
5715 From MAILER-DAEMON-1 Wed Oct 2 01:50:07 1996
5716 Date: Wed, 02 Oct 1996 01:50:07 +0000
5718 Subject: Bad bad message 1
5720 From me to you, blinde Kuh!
5722 From MAILER-DAEMON-2 Wed Oct 2 01:50:07 1996
5723 Date: Wed, 02 Oct 1996 01:50:07 +0000
5725 Subject: Bad bad message 2
5727 From me to you, blindes Kalb!
5729 ${cp} ./.tinv1 ./.tinv2
5733 \\localopts yes; \\wysh set mbox-rfc4155;\\wysh File "${1}";\\
5734 \\eval copy * "${2}"
5736 call mboxfix ./.tinv1 ./.tok' | ${MAILX} ${ARGS} > .tall 2>&1
5738 ${cat} ./.tinv1 ./.tok >> .tall
5739 check 14 - ./.tall '739301109 616'
5742 'wysh file ./.tinv1 # ^From not repaired, but missing trailing NL is
5743 wysh File ./.tok # Just move away to nowhere
5745 wysh file ./.tinv2 # Fully repaired
5746 File ./.tok' | ${MAILX} ${ARGS} >>${ERR} 2>&1
5748 # Equal since [Auto-fix when MBOX had From_ errors on read (Dr. Werner
5750 check 15-1 - ./.tinv1 '4151504442 314'
5751 check 15-2 - ./.tinv2 '4151504442 314'
5753 # *mbox-fcc-and-pcc*
5754 ${cat} > ./.ttmpl <<-'_EOT'
5756 Bcc: | cat >> ./.tpcc1
5758 Subject: fcc and pcc, and *mbox-fcc-and-pcc*
5763 < ./.ttmpl ${MAILX} ${ARGS} -t > "${MBOX}" 2>&1
5764 check
16 0 "${MBOX}" '4294967295 0'
5765 check
17 - .
/.tfcc1
'2301294938 148'
5766 check
18 - .
/.tfcc2
'2301294938 148'
5767 check
19 - .
/.tpcc1
'2301294938 148'
5769 < .
/.ttmpl
${MAILX} ${ARGS} -t -Snombox-fcc-and-pcc > "${MBOX}" 2>&1
5770 check 20 0 "${MBOX}" '4294967295 0'
5771 check 21 - ./.tfcc1 '3629108107 98'
5772 check 22 - ./.tfcc2 '3629108107 98'
5773 check 23 - ./.tpcc1 '2373220256 246'
5775 # More invalid: since in "copy
* X
" messages will be copied in `sort' order,
5776 # reordering may happen, and before ([f5db11fe] (a_cwrite_save1(): FIX:
5777 # ensure pre-v15 MBOX separation "in between
" messages.., 2019-08-07) that
5778 # could still have created invalid MBOX files!
5779 ${cat} <<-_EOT > ./.tinv1
5782 From MAILER-DAEMON-4 Sun Oct 4 01:50:07 1998
5783 Date: Sun, 04 Oct 1998 01:50:07 +0000
5788 From MAILER-DAEMON-0 Fri Oct 28 21:02:21 2147483649
5789 Date: Nix, 01 Oct BAD 01:50:07 +0000
5794 From MAILER-DAEMON-3 Fri Oct 3 01:50:07 1997
5795 Date: Fri, 03 Oct 1997 01:50:07 +0000
5800 From MAILER-DAEMON-1 Sun Oct 1 01:50:07 1995
5801 Date: Sun, 01 Oct 1995 01:50:07 +0000
5807 From MAILER-DAEMON-2 Wed Oct 2 01:50:07 1996
5808 Date: Wed, 02 Oct 1996 01:50:07 +0000
5819 file ./.tinv1' | ${MAILX} ${ARGS} >>${ERR} 2>&1
5820 check 24 0 ./.tinv1 '104184185 560'
5821 check 25 - ./.tinv2 '853754737 510'
5829 if have_feat maildir; then :; else
5830 t_echoskip '[!MAILDIR]'
5837 while [ ${i} -lt 112 ]; do
5838 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
5839 "${MBOX}" "${i}" "${i}"
5842 ) | ${MAILX} ${ARGS}
5843 check 1 0 "${MBOX}" '2366902811 13332'
5849 ' "${MBOX}" .tmdir1 .tmdir1 |
5850 ${MAILX} ${ARGS} -Snewfolders=maildir -Sshowlast > .tlst
5851 check 2 0 .tlst '3442251309 8991'
5854 copy * "maildir
://%s
"
5857 ' "${MBOX}" .tmdir2 .tmdir2 |
5858 ${MAILX} ${ARGS} -Sshowlast > .tlst
5859 check 3 0 .tlst '3524806062 9001'
5861 printf 'File "maildir
://%s
"
5865 ' .tmdir2 .tmbox1 .tmbox1 |
5866 ${MAILX} ${ARGS} -Sshowlast > .tlst
5867 check 4 0 .tmbox1 '4096198846 12772'
5868 check 5 - .tlst '1262452287 8998'
5870 # only the odd (even)
5872 printf 'File "maildir
://%s
"
5875 while [ ${i} -lt 112 ]; do
5877 [ ${j} -eq 1 ] && printf '%s ' "${i}"
5884 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
5885 check 6 0 .tmbox2 '4228337024 6386'
5886 check 7 - .tlst '2078821439 4517'
5889 printf 'file "maildir
://%s
"
5892 while [ ${i} -lt 112 ]; do
5894 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
5902 ' .tmbox2 .tmbox2 .tmdir2
5903 ) |
${MAILX} ${ARGS} -Sshowlast > .tlst
5904 check
8 0 .tmbox2
'978751761 12656'
5905 ${sed} 2d
< .tlst
> .tlstx
5906 check
9 - .tlstx
'2172297531 13477'
5908 # More invalid: since in "copy * X" messages will be copied in `sort' order,
5909 # reordering may happen, and before ([f5db11fe] (a_cwrite_save1(): FIX:
5910 # ensure pre-v15 MBOX separation "in between" messages.., 2019-08-07) that
5911 # could still have created invalid MBOX files!
5912 ${cat} <<-_EOT > ./.tinv1
5915 From MAILER-DAEMON-4 Sun Oct 4 01:50:07 1998
5916 Date: Sun, 04 Oct 1998 01:50:07 +0000
5921 From MAILER-DAEMON-0 Fri Oct 28 21:02:21 2147483649
5922 Date: Nix, 01 Oct BAD 01:50:07 +0000
5927 From MAILER-DAEMON-3 Fri Oct 3 01:50:07 1997
5928 Date: Fri, 03 Oct 1997 01:50:07 +0000
5933 From MAILER-DAEMON-1 Sun Oct 1 01:50:07 1995
5934 Date: Sun, 01 Oct 1995 01:50:07 +0000
5940 From MAILER-DAEMON-2 Wed Oct 2 01:50:07 1996
5941 Date: Wed, 02 Oct 1996 01:50:07 +0000
5950 copy * maildir://./.tmdir10
5951 !{ for f in ./.tmdir10/new/*; do echo ===; %s $f; done; } > ./.t11
5955 ' "${cat}" | ${MAILX} ${ARGS} >>${ERR} 2>&1
5956 # Note that substdate() fixes all but one From_ line to $SOURCE_DATE_EPOCH!
5957 check 10 0 ./.t10warp '3551111321 502'
5958 check 11 - ./.t11 '642719592 302'
5964 # MIME and RFC basics {{{
5965 t_mime_if_not_ascii() {
5968 </dev/null ${MAILX} ${ARGS} -s Subject "${MBOX}" >> "${MBOX}" 2>&1
5969 check
1 0 "${MBOX}" '3647956381 106'
5971 </dev
/null
${MAILX} ${ARGS} -Scharset-7bit=not-ascii -s Subject "${MBOX}" \
5973 check 2 0 "${MBOX}" '3964303752 274'
5982 printf 'Hey, you.\nFrom me to you\nCiao\n' |
5983 ${MAILX} ${ARGS} -s Subject -Smime-encoding=8b "${MBOX}" \
5985 check
1 0 "${MBOX}" '3835153597 136'
5986 printf 'Hey, you.\n\nFrom me to you\nCiao.\n' |
5987 ${MAILX} ${ARGS} -s Subject -Smime-encoding=8b "${MBOX}" \
5989 check 2 0 "${MBOX}" '63875210 275'
5992 printf 'Hey, you.\n From me to you\nCiao\n' |
5993 ${MAILX} ${ARGS} -s Subject -Smime-encoding=qp "${MBOX}" \
5995 check
3 0 "${MBOX}" '465798521 412'
5996 printf 'Hey, you.\nFrom me to you\nCiao\n' |
5997 ${MAILX} ${ARGS} -s Subject -Smime-encoding=qp "${MBOX}" \
5999 check 4 0 "${MBOX}" '2075263697 655'
6002 printf 'Hey, you.\n From me to you\nCiao\n' |
6003 ${MAILX} ${ARGS} -s Subject -Smime-encoding=b64 "${MBOX}" \
6005 check
5 0 "${MBOX}" '601672771 792'
6006 printf 'Hey, you.\nFrom me to you\nCiao\n' |
6007 ${MAILX} ${ARGS} -s Subject -Smime-encoding=b64 "${MBOX}" \
6009 check 6 0 "${MBOX}" '3926760595 1034'
6014 t_xxxheads_rfc2047() {
6017 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
6018 -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̲' \
6020 check 1 0 "${MBOX}" '3422562347 371'
6022 # Single word (overlong line split -- bad standard! Requires injection of
6023 # artificial data!! But can be prevented by using RFC 2047 encoding)
6025 i=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_
"}'`
6026 echo | ${MAILX} ${ARGS} -s "${i}" "${MBOX}"
6027 check
2 0 "${MBOX}" '3317256266 1714'
6029 # Combination of encoded words, space and tabs of varying sort
6031 echo |
${MAILX} ${ARGS} ${ADDARG_UNI} \
6032 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
6033 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
6034 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
6035 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
6036 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
6038 check
3 0 "${MBOX}" '786672837 587'
6040 # Overlong multibyte sequence that must be forcefully split
6041 # todo This works even before v15.0, but only by accident
6043 echo |
${MAILX} ${ARGS} ${ADDARG_UNI} \
6044 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
6045 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
6046 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
6048 check
4 0 "${MBOX}" '2889557767 655'
6052 echo |
${MAILX} ${ARGS} \
6053 -s "1-1 B2 B3 B4 B5 B6 B\
6054 1-2 B2 B3 B4 B5 B6 B\
6055 1-3 B2 B3 B4 B5 B6 B\
6056 1-4 B2 B3 B4 B5 B6 B\
6057 1-5 B2 B3 B4 B5 B6 B\
6058 1-6 B2 B3 B4 B5 B6 " \
6060 check
5 0 "${MBOX}" '3135161683 293'
6062 # Leading and trailing WS
6064 echo |
${MAILX} ${ARGS} \
6065 -s " 2-1 B2 B3 B4 B5 B6 B\
6066 1-2 B2 B3 B4 B5 B6 B\
6067 1-3 B2 B3 B4 B5 B6 B\
6068 1-4 B2 B3 B4 B5 B6 " \
6070 check
6 0 "${MBOX}" '3221845405 232'
6072 # RFC 2047 in an address field! (Missing test caused v14.9.6!)
6074 echo "Dat Früchtchen riecht häußlich" |
6075 ${MAILX} ${ARGS} ${ADDARG_UNI} -Sfullnames -Smta=test://"$MBOX" \
6077 'Schnödes "Früchtchen" <do@du> (Hä!)'
6078 check
7 0 "${MBOX}" '3681801246 373'
6080 # RFC 2047 in an address field, and iconv involved
6081 if have_feat
iconv; then
6083 ${cat} > .
/.trebox
<<_EOT
6084 From zaza@exam.ple Fri Mar 2 21:31:56 2018
6085 Date: Fri, 2 Mar 2018 20:31:45 +0000
6086 From: z=?iso-8859-1?Q?=E1?=za <zaza@exam.ple>
6087 To: dude <dude@exam.ple>
6088 Subject: houston(...)
6089 Message-ID: <abra@1>
6091 Content-Type: text/plain; charset=iso-8859-1
6092 Content-Disposition: inline
6093 Content-Transfer-Encoding: 8bit
6096 echo reply |
${MAILX} ${ARGS} ${ADDARG_UNI} \
6097 -Sfullnames -Sreply-in-same-charset \
6098 -Smta=test://"$MBOX" -Rf .
/.trebox
6099 check
8 0 "${MBOX}" '3499372945 285'
6101 t_echoskip
'8:[!ICONV]'
6107 t_iconv_mbyte_base64
() { # TODO uses sed(1) and special *headline*!!
6110 if [ -n "${UTF8_LOCALE}" ] && have_feat multibyte-charsets
&&
6111 have_feat
iconv; then
6112 if (</dev
/null
iconv -f ascii
-t iso-2022-jp
) >/dev
/null
2>&1 ||
6113 (</dev
/null
iconv -f ascii
-t euc-jp
) >/dev
/null
2>&1; then
6116 t_echoskip
'[ICONV/iconv(1):missing conversion(s)]'
6121 t_echoskip
'[no UTF-8 locale or !MULTIBYTE-CHARSETS or !ICONV]'
6126 if (</dev
/null
iconv -f ascii
-t iso-2022-jp
) >/dev
/null
2>&1; then
6127 ${cat} <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
6128 -Smta=test://"$MBOX" \
6129 -Sescape=! -Smime-encoding=base64
2>.
/.terr
6130 set ttycharset
=utf-8 sendcharsets
=iso-2022-jp
6132 !s Japanese from UTF-8 to ISO-2022-JP
6133 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの
1種をシジュウカラと呼ぶ。
6135 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
6138 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
6140 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの
1種をシジュウカラと呼ぶ。
6143 set ttycharset
=iso-2022-jp charset-7bit
=iso-2022-jp sendcharsets
=utf-8
6145 !s Japanese from ISO-2022-JP to UTF-8
, eh
, no
, also ISO-2022-JP
6146 \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
6148 \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
6151 \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
6153 \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
6156 # May not presume iconv output as long as roundtrip possible [489a7122]
6158 ${awk} 'BEGIN{h=1}/^$/{++h;next}{if(h % 2 == 1)print}' \
6159 < "${MBOX}" > ./.tcksum
6160 check 1 - ./.tcksum '3314001564 516'
6161 check 2 - ./.terr '4294967295 0'
6163 printf 'eval f 1; eval write ./.twrite; eval type 1; eval type 2\n' |
6164 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
6165 -S headline="%>%a%m %-18f %-16d %i%-s" \
6166 -Rf "${MBOX}" >./.tlog 2>&1
6167 check 3 0 ./.twrite '1259742080 686'
6168 #check 4 - ./.tlog '3214068822 2123'
6169 ${sed} -e '/^\[-- M/d' < ./.tlog > ./.txlog
6170 check 4 - ./.txlog '4083300132 2030'
6172 t_echoskip '1-4:[ICONV/iconv(1):ISO-2022-JP unsupported]'
6175 if (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
6176 ${rm} -f "${MBOX}" ./.twrite
6177 ${cat} <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
6178 -Smta=test://"$MBOX" \
6179 -Sescape=! -Smime-encoding=base64 2>./.terr
6180 set ttycharset=utf-8 sendcharsets=euc-jp
6182 !s Japanese from UTF-8 to EUC-JP
6183 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
6185 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
6188 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
6190 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
6193 set ttycharset=EUC-JP sendcharsets=utf-8
6195 !s Japanese from EUC-JP to UTF-8
6196 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
6198 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
6201 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
6203 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
6207 ${awk} 'BEGIN{h=1}/^$/{++h;next}{if(h % 2 == 1)print}' \
6208 < "${MBOX}" > ./.tcksum
6209 check 5 - ./.tcksum '1754179361 469'
6210 check 6 - ./.terr '4294967295 0'
6212 printf 'eval f 1; eval write ./.twrite; eval type 1; eval type 2\n' |
6213 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
6214 -S headline="%>%a%m %-18f %-16d %i%-s" \
6215 -Rf "${MBOX}" >./.tlog 2>&1
6216 check 7 0 ./.twrite '1259742080 686'
6217 #check 8 - ./.tlog '2506063395 2075'
6218 ${sed} -e '/^\[-- M/d' < ./.tlog > ./.txlog
6219 check 8 - ./.txlog '3192017734 1983'
6221 t_echoskip '5-8:[ICONV/iconv(1):EUC-JP unsupported]'
6227 t_iconv_mainbody() {
6230 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv; then :; else
6231 t_echoskip '[no UTF-8 locale or !ICONV]'
6236 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=test://"$MBOX" \
6237 -S charset-7bit=us-ascii -S charset-8bit=utf-8 \
6238 -s '–' over-the@rain.bow 2>./.terr
6239 check 1 0 "${MBOX}" '3559538297 250'
6240 check 2 - ./.terr '4294967295 0'
6242 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=test://"$MBOX" \
6243 -S charset-7bit=us-ascii -S charset-8bit=us-ascii \
6244 -s '–' over-the@rain.bow 2>./.terr
6246 check 3 - "${MBOX}" '3559538297 250'
6247 if have_feat uistrings; then
6248 check 4 - ./.terr '271380835 121'
6250 t_echoskip '4:[!UISTRINGS]'
6253 # The different iconv(3) implementations use different replacement sequence
6254 # types (character-wise, byte-wise, and the character(s) used differ)
6255 i="${MAILX_ICONV_MODE}"
6256 if [ -n "${i}" ]; then
6257 printf 'p\nx\n' | ${MAILX} ${ARGS} -Rf "${MBOX}" >./.tout 2>./.terr
6259 check_ex0 5-1-estat ${j}
6260 check 5-1 - ./.terr '4294967295 0'
6261 if [ ${i} -eq 13 ]; then
6262 check 5-2 - ./.tout '189327996 283' # XXX old (before test MTA)
6263 elif [ ${i} -eq 12 ]; then
6264 check 5-3 - ./.tout '1959197095 283' # XXX old (before test MTA)
6265 elif [ ${i} -eq 3 ]; then
6266 check 5-4 - ./.tout '3544755786 278'
6268 check 5-5 - ./.tout '2381160335 278'
6271 t_echoskip '5:[test unsupported]'
6277 t_binary_mainbody() {
6280 printf 'abra\0\nka\r\ndabra' |
6281 ${MAILX} ${ARGS} ${ADDARG_UNI} -s 'binary with carriage-return!' \
6283 check 1 0 "${MBOX}" '1629827 239'
6284 check 2 - ./.terr '4294967295 0'
6286 printf 'p\necho\necho writing now\nwrite ./.twrite\n' |
6287 ${MAILX} ${ARGS} -Rf \
6288 -Spipe-application/octet-stream="?* ${cat} > ./.tcat" \
6289 "${MBOX}" >./.tall 2>&1
6290 check 3 0 ./.tall '733582513 319'
6291 check 4 - ./.tcat '3817108933 15'
6292 check 5 - ./.twrite '3817108933 15'
6297 t_mime_force_sendout() {
6300 if have_feat iconv; then :; else
6301 t_echoskip '[!ICONV]'
6306 printf '\150\303\274' > ./.tmba
6307 printf 'ha' > ./.tsba
6308 printf '' > "${MBOX}"
6310 printf '\150\303\244' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6312 over-the@rain.bow 2>>${ERR}
6313 check 1 4 "${MBOX}" '4294967295 0'
6315 printf '\150\303\244' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6316 -s go -Smime-force-sendout \
6317 over-the@rain.bow 2>>${ERR}
6318 check 2 0 "${MBOX}" '1866273282 219'
6320 printf ha | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6322 -a ./.tmba over-the@rain.bow 2>>${ERR}
6323 check 3 4 "${MBOX}" '1866273282 219'
6325 printf ha | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6326 -s go -Smime-force-sendout \
6327 -a ./.tmba over-the@rain.bow 2>>${ERR}
6328 check 4 0 "${MBOX}" '644433809 880'
6330 printf ha | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6332 -a ./.tsba -a ./.tmba over-the@rain.bow 2>>${ERR}
6333 check 5 4 "${MBOX}" '644433809 880'
6335 printf ha | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6336 -s go -Smime-force-sendout \
6337 -a ./.tsba -a ./.tmba over-the@rain.bow 2>>${ERR}
6338 check 6 0 "${MBOX}" '3172365123 1729'
6340 printf '\150\303\244' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6342 -a ./.tsba -a ./.tmba over-the@rain.bow 2>>${ERR}
6343 check 7 4 "${MBOX}" '3172365123 1729'
6345 printf '\150\303\244' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6346 -s go -Smime-force-sendout \
6347 -a ./.tsba -a ./.tmba over-the@rain.bow 2>>${ERR}
6348 check 8 0 "${MBOX}" '4002905306 2565'
6353 t_C_opt_customhdr() {
6357 ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6358 -C 'C-One : Custom One Body' \
6359 -C 'C-Two:CustomTwoBody' \
6360 -C 'C-Three: CustomThreeBody ' \
6361 -S customhdr='chdr1: chdr1 body, chdr2:chdr2 body, chdr3: chdr3 body ' \
6362 this-goes@nowhere >./.tall 2>&1
6364 ${cat} ./.tall >> "${MBOX}"
6365 check 1 0 "${MBOX}" '2535463301 238'
6368 printf 'm this-goes@nowhere\nbody\n!.
6370 m this-goes2@nowhere\nbody2\n!.
6371 set customhdr=%ccustom1 : custom1 body%c
6372 m this-goes3@nowhere\nbody3\n!.
6373 set customhdr=%ccustom1 : custom1\\, body , \\
6374 custom2: custom2 body , custom-3 : custom3 body ,\\
6375 custom-4:custom4-body %c
6376 m this-goes4@nowhere\nbody4\n!.
6378 ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sescape=! \
6379 -C 'C-One : Custom One Body' \
6380 -C 'C-Two:CustomTwoBody' \
6381 -C 'C-Three: CustomThreeBody ' \
6382 -C ' C-Four:CustomFourBody ' \
6383 -C 'C-Five:CustomFiveBody' \
6384 -S customhdr='ch1: b1 , ch2:b2, ch3:b3 ,ch4:b4, ch5: b5 ' \
6387 ${cat} ./.tall >> "${MBOX}"
6388 check 2 0 "${MBOX}" '544085062 1086'
6394 # Operational basics with trivial tests {{{
6398 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" > ./.tall 2>&1
6400 alias a1 ex2@a1.ple "EX3 <ex3@a1.ple>"
6402 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
6404 alias a4 a5 ex1@a4.ple
6406 alias a6 a7 ex1@a6.ple
6420 check 1 0 "${MBOX}" '139467786 277'
6421 check 2 - .tall '1598893942 133'
6423 if have_feat uistrings; then
6424 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
6425 commandalias x echo '$?/$^ERRNAME'
6427 alias a:bra! ha@m beb@ra ha@m '' zeb@ra ha@m; x
6429 alias ha@m ham-expansion ha@m '';x
6431 alias beb@ra ceb@ra beb@ra1;x
6433 alias ceb@ra ceb@ra1;x
6451 \alias noexpa@and this@error1;x
6452 \alias ha@m '\noexp@and' expa@and \\noexp@and2;x
6455 \alias noexpa@and2 this@error2;x
6456 \alias expa1@and this@error3;x
6457 \alias expa@and \\expa1@and;x
6462 check 3 0 "${MBOX}" '1513155156 796'
6464 t_echoskip '3:[!UISTRINGS]'
6467 # TODO t_alias: n_ALIAS_MAXEXP is compile-time constant,
6468 # TODO need to somehow provide its contents to the test, then test
6476 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
6477 commandalias x echo '$?/$^ERRNAME'
6479 charsetalias latin1 latin15;x
6480 charsetalias latin1;x
6481 charsetalias - latin1;x
6483 charsetalias cp1252 latin1 latin15 utf8 utf8 utf16;x
6484 charsetalias cp1252;x
6485 charsetalias latin15;x
6488 charsetalias - cp1252;x
6489 charsetalias - latin15;x
6490 charsetalias - utf8;x
6492 charsetalias latin1;x
6493 charsetalias - latin1;x
6494 uncharsetalias latin15;x
6495 charsetalias latin1;x
6496 charsetalias - latin1;x
6498 check 1 0 "${MBOX}" '3551595280 433'
6506 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
6507 commandalias x echo '$?/$^ERRNAME'
6509 shortcut file1 expansion-of-file1;x
6510 shortcut file2 expansion-of-file2;x
6511 shortcut file3 expansion-of-file3;x
6512 shortcut file4 'expansion of file4' 'file 5' 'expansion of file5';x
6522 check 1 0 "${MBOX}" '1970515669 430'
6530 if have_feat netrc; then :; else
6531 t_echoskip '[!NETRC]'
6537 machine x.local login a1 machine x.local login a2 password p2
6538 machine x.local login a3 password "p 3"
6545 machine *.x.local login a2 password p2-any!
6546 machine y.local login ausr password apass
6550 # and unused default
6551 default login defacc password defpass
6553 ${chmod} 0600 ./.tnetrc
6555 printf 'netrc;echo =$?;netrc c;echo =$?;netr loa;echo =$?;netr s;echo =$?' |
6556 NETRC=./.tnetrc ${MAILX} ${ARGS} > "${MBOX}" 2>&1
6557 check 1 0 "${MBOX}" '2911708535 542'
6559 have_feat uistrings && i='3076722625 893' || i='3808149439 645'
6565 echo ==(re)load cache
6566 netrc load;echo $?/$^ERRNAME
6568 netrc loo a1@x.local
6569 netrc loo a2@x.local
6570 netrc loo a3@x.local
6571 netrc loo a4@x.local
6573 netrc clear;echo $?/$^ERRNAME
6575 netrc loo a2@pop.x.local
6576 netrc loo a2@imap.x.local
6577 netrc loo a2@smtp.x.local
6579 netrc loo a2@nono.smtp.x.local
6580 echo ==[usr@]unknown-host
6582 netrc loo defacc@a.local
6583 netrc loo a1@a.local
6584 ' | NETRC=./.tnetrc ${MAILX} ${ARGS} > "${MBOX}" 2>&1
6585 check 2 0 "${MBOX}" "${i}"
6591 # Operational basics with easy tests {{{
6594 # MTA alias specific part in t_mta_aliases()
6595 # This only tests from command line, rest later on (iff any)
6598 if have_feat uistrings; then :; else
6599 t_echoskip '[!UISTRINGS]'
6604 echo "${cat}" > ./.tcat
6605 ${chmod} 0755 ./.tcat
6608 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6609 -X'alias talias talias@exam.ple' \
6610 './.tfile' ' | ./.tcat > ./.tpipe' 'talias' 'taddr@exam.ple' \
6612 check 1 4 "${MBOX}" '1216011460 138'
6613 check 2 - .tall '4169590008 162'
6616 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6618 -X'alias talias talias@exam.ple' \
6619 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6621 check 3 0 "${MBOX}" '847567042 276'
6622 check 4 - .tall '4294967295 0'
6623 check 5 - .tfile '1216011460 138'
6624 check 6 - .tpipe '1216011460 138'
6627 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6628 -Sexpandaddr=-all,+file,+pipe,+name,+addr \
6629 -X'alias talias talias@exam.ple' \
6630 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6632 check 7 0 "${MBOX}" '3682360102 414'
6633 check 8 - .tall '4294967295 0'
6634 check 9 - .tfile '847567042 276'
6635 check 10 - .tpipe '1216011460 138'
6638 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6639 -Sexpandaddr=-all,+file,-file,+pipe,+name,+addr \
6640 -X'alias talias talias@exam.ple' \
6641 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6643 check 11 4 "${MBOX}" '1010907786 552'
6644 check 12 - .tall '673208446 70'
6645 check 13 - .tfile '847567042 276'
6646 check 14 - .tpipe '1216011460 138'
6648 printf '' > ./.tpipe
6649 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6650 -Sexpandaddr=fail,-all,+file,-file,+pipe,+name,+addr \
6651 -X'alias talias talias@exam.ple' \
6652 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6654 check 15 4 "${MBOX}" '1010907786 552'
6655 check 16 - .tall '3280630252 179'
6656 check 17 - .tfile '847567042 276'
6657 check 18 - .tpipe '4294967295 0'
6660 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6661 -Sexpandaddr=-all,+file,+pipe,-pipe,+name,+addr \
6662 -X'alias talias talias@exam.ple' \
6663 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6665 check 19 4 "${MBOX}" '3359494254 690'
6666 check 20 - .tall '4052857227 91'
6667 check 21 - .tfile '3682360102 414'
6668 check 22 - .tpipe '4294967295 0'
6670 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6671 -Sexpandaddr=fail,-all,+file,+pipe,-pipe,+name,+addr \
6672 -X'alias talias talias@exam.ple' \
6673 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6675 check 23 4 "${MBOX}" '3359494254 690'
6676 check 24 - .tall '2168069102 200'
6677 check 25 - .tfile '3682360102 414'
6678 check 26 - .tpipe '4294967295 0'
6681 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6682 -Sexpandaddr=-all,+file,+pipe,+name,-name,+addr \
6683 -X'alias talias talias@exam.ple' \
6684 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6686 check 27 0 "${MBOX}" '3735108703 828'
6687 check 28 - .tall '4294967295 0'
6688 check 29 - .tfile '1010907786 552'
6689 check 30 - .tpipe '1216011460 138'
6691 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6692 -Sexpandaddr=-all,+file,+pipe,+name,-name,+addr \
6693 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6695 check 31 4 "${MBOX}" '4225234603 949'
6696 check 32 - .tall '3486613973 73'
6697 check 33 - .tfile '452731060 673'
6698 check 34 - .tpipe '1905076731 121'
6700 printf '' > ./.tpipe
6701 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6702 -Sexpandaddr=fail,-all,+file,+pipe,+name,-name,+addr \
6703 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6705 check 35 4 "${MBOX}" '4225234603 949'
6706 check 36 - .tall '3032065285 182'
6707 check 37 - .tfile '452731060 673'
6708 check 38 - .tpipe '4294967295 0'
6711 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6712 -Sexpandaddr=-all,+file,+pipe,+name,+addr,-addr \
6713 -X'alias talias talias@exam.ple' \
6714 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6716 check 39 4 "${MBOX}" '4225234603 949'
6717 check 40 - .tall '3863610168 169'
6718 check 41 - .tfile '1975297706 775'
6719 check 42 - .tpipe '130065764 102'
6721 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6722 -Sexpandaddr=-all,+file,+pipe,+name,+addr,-addr \
6723 -Sadd-file-recipients \
6724 -X'alias talias talias@exam.ple' \
6725 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6727 check 43 4 "${MBOX}" '4225234603 949'
6728 check 44 - .tall '3863610168 169'
6729 check 45 - .tfile '3291831864 911'
6730 check 46 - .tpipe '4072000848 136'
6732 printf '' > ./.tpipe
6733 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6734 -Sexpandaddr=fail,-all,+file,+pipe,+name,+addr,-addr \
6735 -Sadd-file-recipients \
6736 -X'alias talias talias@exam.ple' \
6737 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6739 check 47 4 "${MBOX}" '4225234603 949'
6740 check 48 - .tall '851041772 278'
6741 check 49 - .tfile '3291831864 911'
6742 check 50 - .tpipe '4294967295 0'
6745 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6746 -Sexpandaddr=-all,+addr \
6747 'taddr@exam.ple' 'this@@c.example' \
6749 check 51 4 "${MBOX}" '473729143 1070'
6750 check 52 - .tall '2646392129 66'
6752 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6753 -Sexpandaddr=-all,failinvaddr \
6754 'taddr@exam.ple' 'this@@c.example' \
6756 check 53 4 "${MBOX}" '473729143 1070'
6757 check 54 - .tall '887391555 175'
6760 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6761 -Sthis=taddr@exam.ple -Sexpandaddr \
6762 -c '\$this' -b '\$this' '\$this' \
6764 check 55 4 "${MBOX}" '473729143 1070'
6765 check 56 - .tall '1144578880 139'
6767 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6768 -Sthis=taddr@exam.ple -Sexpandaddr=shquote \
6769 -c '\$this' -b '\$this' '\$this' \
6771 check 57 0 "${MBOX}" '398243793 1191'
6772 check 58 - .tall '4294967295 0'
6775 printf '' > "${MBOX}"
6777 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6778 -Sadd-file-recipients \
6779 -Sexpandaddr=-all,+fcc \
6784 check 59 0 "${MBOX}" '4294967295 0'
6785 check 60 - .tall '4294967295 0'
6786 check 61 - .tfile1 '1067276522 124'
6787 check 62 - .tfile2 '1067276522 124'
6789 printf '' > "${MBOX}"
6791 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6792 -Sadd-file-recipients \
6793 -Sexpandaddr=-all,+file \
6798 check 63 0 "${MBOX}" '4294967295 0'
6799 check 64 - .tall '4294967295 0'
6800 check 65 - .tfile1 '2677253527 248'
6801 check 66 - .tfile2 '2677253527 248'
6803 printf '' > "${MBOX}"
6805 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6806 -Sadd-file-recipients \
6807 -Sexpandaddr=-all,+file,-fcc \
6812 check 67 0 "${MBOX}" '4294967295 0'
6813 check 68 - .tall '4294967295 0'
6814 check 69 - .tfile1 '3493511004 372'
6815 check 70 - .tfile2 '3493511004 372'
6817 printf '' > "${MBOX}"
6819 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6820 -Sadd-file-recipients \
6821 -Sexpandaddr=-all,+fcc,-file \
6826 check 71 4 "${MBOX}" '4294967295 0'
6827 check 72 - .tall '203687556 223'
6828 check 73 - .tfile1 '3493511004 372'
6829 check 74 - .tfile2 '3493511004 372'
6831 printf '' > "${MBOX}"
6833 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6834 -Sadd-file-recipients \
6835 -Sexpandaddr=-all,fail,+addr \
6841 check 75 4 "${MBOX}" '4294967295 0'
6842 check 76 - .tall '4060426468 247'
6843 check 77 - .tfile1 '3493511004 372'
6844 check 78 - .tfile2 '3493511004 372'
6847 printf '' > "${MBOX}"
6849 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6850 -Sexpandaddr=fail,domaincheck \
6854 check 79 0 "${MBOX}" '171635532 120'
6855 check 80 - .tall '4294967295 0'
6858 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6859 -Sexpandaddr=domaincheck \
6861 To: one@localhost , Hey two <two@exam.ple>, Trouble <three@tro.uble>
6863 check 81 4 "${MBOX}" '2659464839 240'
6864 check 82 - .tall '1119895397 158'
6867 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6868 -Sexpandaddr=fail,domaincheck \
6870 To: one@localhost , Hey two <two@exam.ple>, Trouble <three@tro.uble>
6872 check 83 4 "${MBOX}" '2659464839 240'
6873 check 84 - .tall '1577313789 267'
6876 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6877 -Sexpandaddr=fail,domaincheck \
6878 -Sexpandaddr-domaincheck=exam.ple,tro.uble \
6880 To: one@localhost , Hey two <two@exam.ple>, Trouble <three@tro.uble>
6882 check 85 0 "${MBOX}" '1670655701 410'
6883 check 86 - .tall '4294967295 0'
6889 # after: t_expandaddr
6892 if have_feat mta-aliases; then :; else
6893 t_echoskip '[!MTA_ALIASES]'
6898 ${cat} > ./.tali <<- '__EOT'
6904 ex2@a1.ple, <ex3@a1.ple> ,
6906 a2: ex1@a2.ple , ex2@a2.ple,a2_2
6907 a2_2:ex3@a2.ple,ex4@a2.ple
6920 echo | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6921 -Smta-aliases=./.tali \
6922 -b a3 -c a2 a1 > ./.tall 2>&1
6923 check 1 0 "${MBOX}" '1172368381 238'
6924 check 2 - .tall '4294967295 0'
6926 ## xxx The following are actually *expandaddr* tests!!
6928 # May not send plain names over SMTP!
6930 if have_feat smtp; then
6931 echo | ${MAILX} ${ARGS} \
6932 -Smta=smtp://laber.backe -Ssmtp-auth=none \
6933 -Smta-aliases=./.tali \
6934 -b a3 -c a2 a1 > ./.tall 2>&1
6936 check 4 - "${MBOX}" '1172368381 238'
6939 if [ -n "${mtaali}" ] && have_feat uistrings; then
6940 check 5 - .tall '771616226 179'
6942 t_echoskip '5:[!SMTP/!UISTRINGS]'
6945 # xxx for false-positive SMTP test we would need some mocking
6946 echo | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6947 -Sexpandaddr=fail,-name \
6948 -Smta-aliases=./.tali \
6949 -b a3 -c a2 a1 > ./.tall 2>&1
6951 check 7 - "${MBOX}" '1172368381 238'
6952 if have_feat uistrings; then
6953 check 8 - .tall '2834389894 178'
6955 t_echoskip '8:[!UISTRINGS]'
6958 echo | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6959 -Sexpandaddr=-name \
6960 -Smta-aliases=./.tali \
6961 -b a3 -c a2 a1 > ./.tall 2>&1
6962 check 9 4 "${MBOX}" '2322273994 472'
6963 if have_feat uistrings; then
6964 check 10 - .tall '2136559508 69'
6966 t_echoskip '10:[!UISTRINGS]'
6969 echo 'a9:nine@nine.nine' >> ./.tali
6971 echo | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6972 -Sexpandaddr=fail,-name \
6973 -Smta-aliases=./.tali \
6974 -b a3 -c a2 a1 > ./.tall 2>&1
6975 check 11 0 "${MBOX}" '2422268299 722'
6976 check 12 - .tall '4294967295 0'
6979 set expandaddr=-name
6983 !^header insert bcc a3
6989 !^header insert bcc a3
6992 echo and, once again, check that cache is updated
6993 # Enclose one pipe in quotes: immense stress for our stupid address parser:(
6994 !echo "a10:./.tf1,|%s>./.tp1,\\"|%s > ./.tp2\\",./.tf2" >> ./.tali
6999 !^header insert bcc a3
7002 echo trigger happiness
7006 !^header insert bcc "a3 a10"
7009 ' "${cat}" "${cat}" | ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sescape=! \
7010 -Smta-aliases=./.tali \
7012 check 13 0 "${MBOX}" '550955032 1469'
7013 if have_feat uistrings; then
7014 check 14 - .tall '1795496020 473'
7016 t_echoskip '14:[!UISTRINGS]'
7018 check 15 - .tf1 '3056269950 249'
7019 check 16 - .tp1 '3056269950 249'
7020 check 17 - .tp2 '3056269950 249'
7021 check 18 - .tf2 '3056269950 249'
7023 # TODO t_mta_aliases: n_ALIAS_MAXEXP is compile-time constant,
7024 # TODO need to somehow provide its contents to the test, then test
7032 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ %s\n~.\n' \
7033 "${TOPDIR}snailmail.jpg" | ${MAILX} ${ARGS} -Smta=test://"$MBOX"
7034 check 1 0 "${MBOX}" '1314354444 13536'
7036 if (echo | gzip -c) >/dev/null 2>&1; then
7038 printf 'File "%s"\ncopy 1 ./.t.mbox.gz\ncopy 2 ./.t.mbox.gz' \
7039 "${MBOX}" | ${MAILX} ${ARGS} \
7040 -X'filetype gz gzip\ -dc gzip\ -c'
7041 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
7042 ${MAILX} ${ARGS} -X'filetype gz gzip\ -dc gzip\ -c'
7044 check 2 - ./.t.mbox '1314354444 13536'
7045 check 3 - ./.t.out '635961640 103'
7047 t_echoskip '2:[missing gzip(1)]'
7048 t_echoskip '3:[missing gzip(1)]'
7053 printf 'File "%s"\ncopy 1 ./.t.mbox.gz
7059 -X'filetype gz gzip\ -dc gzip\ -c' \
7060 -X'filetype mbox.gz "${sed} 1,3d|${cat}" \
7061 "echo eins;echo zwei;echo und mit ${sed} bist Du dabei;${cat}"'
7062 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
7064 -X'filetype gz gzip\ -dc gzip\ -c' \
7065 -X'filetype mbox.gz "${sed} 1,3d|${cat}" kill\ 0'
7067 check 4 - ./.t.mbox '2687765142 27092'
7068 check 5 - ./.t.out '2230192693 173'
7077 ${MAILX} ${ARGS} -ef ./.t.mbox
7078 echo ${?} > "${MBOX}"
7080 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
7081 ${MAILX} ${ARGS} -Smta=test://./.t.mbox
7082 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
7083 ${MAILX} ${ARGS} -Smta=test://./.t.mbox
7085 ${MAILX} ${ARGS} -ef ./.t.mbox 2>> "${MBOX}"
7086 echo ${?} >> "${MBOX}"
7087 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox 2>> "${MBOX}"
7088 echo ${?} >> "${MBOX}"
7089 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox 2>> "${MBOX}"
7090 echo ${?} >> "${MBOX}"
7091 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox 2>> "${MBOX}"
7092 echo ${?} >> "${MBOX}"
7093 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox 2>> "${MBOX}"
7094 echo ${?} >> "${MBOX}"
7095 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox 2>> "${MBOX}"
7096 echo ${?} >> "${MBOX}"
7097 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox 2>> "${MBOX}"
7098 echo ${?} >> "${MBOX}"
7100 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}" 2>&1
7101 echo ${?} >> "${MBOX}"
7102 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}" 2>&1
7103 echo ${?} >> "${MBOX}"
7104 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}" 2>&1
7105 echo ${?} >> "${MBOX}"
7106 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}" 2>&1
7107 echo ${?} >> "${MBOX}"
7108 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}" 2>&1
7109 echo ${?} >> "${MBOX}"
7110 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}" 2>&1
7111 echo ${?} >> "${MBOX}"
7112 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>>${ERR}
7113 echo ${?} >> "${MBOX}"
7115 check 1 - "${MBOX}" '1369201287 670'
7119 printf 'm me1@exam.ple\n~s subject cab\nLine 1.\n~.\n' |
7120 ${MAILX} ${ARGS} -Smta=test://./.t.mbox \
7121 -r '' -X 'wysh set from=pony1@$LOGNAME'
7122 printf 'm me2@exam.ple\n~s subject bac\nLine 12.\n~.\n' |
7123 ${MAILX} ${ARGS} -Smta=test://./.t.mbox \
7124 -r '' -X 'wysh set from=pony2@$LOGNAME'
7125 printf 'm me3@exam.ple\n~s subject abc\nLine 123.\n~.\n' |
7126 ${MAILX} ${ARGS} -Smta=test://./.t.mbox \
7127 -r '' -X 'wysh set from=pony3@$LOGNAME'
7129 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
7130 echo fh-test size; set autosort=size showname showto
7131 }' -fH ./.t.mbox > "${MBOX}" 2>&1
7132 check 2 0 "${MBOX}" '4286438644 413'
7134 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
7135 echo fh-test subject; set autosort=subject showname showto
7136 }' -fH ./.t.mbox > "${MBOX}" 2>&1
7137 check 3 0 "${MBOX}" '3208053922 416'
7139 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
7140 echo fh-test from; set autosort=from showto
7141 }' -fH ./.t.mbox > "${MBOX}" 2>&1
7142 check 4 0 "${MBOX}" '4209767839 413'
7144 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
7145 echo fh-test to; set autosort=to showto
7146 }' -fH ./.t.mbox > "${MBOX}" 2>&1
7147 check 5 0 "${MBOX}" '2785342736 411'
7153 # Simple, if we need more here, place in a later vim fold!
7156 # Three tests for MIME encoding and (a bit) content classification.
7157 # At the same time testing -q FILE, < FILE and -t FILE
7158 t__put_body > ./.tin
7160 < ./.tin ${MAILX} ${ARGS} ${ADDARG_UNI} \
7161 -a ./.tin -s "`t__put_subject
`" "${MBOX}"
7162 check 1 0 "${MBOX}" '1088822685 6642'
7165 < /dev/null ${MAILX} ${ARGS} ${ADDARG_UNI} \
7166 -a ./.tin -s "`t__put_subject
`" -q ./.tin "${MBOX}"
7167 check 2 0 "${MBOX}" '1088822685 6642'
7170 ( echo "To: ${MBOX}" && echo "Subject: `t__put_subject
`" && echo &&
7172 ) | ${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a ./.tin -t
7173 check 3 0 "${MBOX}" '1088822685 6642'
7175 # Check comments in the header
7177 ${cat} <<-_EOT | ${MAILX} ${ARGS} -Snodot -t "${MBOX}"
7180 # Noch ein Kommentar
7182 # Nachgestelltes Kommentar
7186 check 4 0 "${MBOX}" '4161555890 124'
7189 printf '' > "${MBOX}"
7190 ( echo 'To?single : ./.tout1 .tout2 ' &&
7191 echo 'CC: ./.tcc1 ./.tcc2' &&
7192 echo 'BcC?sin : ./.tbcc1 .tbcc2 ' &&
7193 echo 'To? : ./.tout3 .tout4 ' &&
7196 ) | ${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -t -Smta=test://"$MBOX"
7197 check 5 0 './.tout1 .tout2' '2948857341 94'
7198 check 6 - ./.tcc1 '2948857341 94'
7199 check 7 - ./.tcc2 '2948857341 94'
7200 check 8 - './.tbcc1 .tbcc2' '2948857341 94'
7201 check 9 - './.tout3 .tout4' '2948857341 94'
7202 check 10 - "${MBOX}" '4294967295 0'
7207 t_message_injections() {
7208 # Simple, if we need more here, place in a later vim fold!
7211 echo mysig > ./.tmysig
7213 echo some-body | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
7214 -Smessage-inject-head=head-inject \
7215 -Smessage-inject-tail="`${cat} .
/.tmysig
`"'\ntail-inject' \
7216 ex@am.ple > ./.tall 2>&1
7217 check 1 0 "${MBOX}" '701778583 143'
7218 check 2 - .tall '4294967295 0' # empty file
7221 ${cat} <<-_EOT > ./.template
7225 Subject: This subject is
7227 Body, body, body me.
7229 < ./.template ${MAILX} ${ARGS} -t -Smta=test://"$MBOX" \
7230 -Smessage-inject-head=head-inject \
7231 -Smessage-inject-tail="`${cat} .
/.tmysig
`\n"'tail-inject' \
7233 check 3 0 "${MBOX}" '2189109479 207'
7234 check 4 - .tall '4294967295 0' # empty file
7240 # TODO More should be in compose mode stuff aka digmsg
7243 ${cat} <<-_EOT > ./.tx
7244 From steffen Sun Feb 18 02:48:40 2018
7245 Date: Sun, 18 Feb 2018 02:48:40 +0100
7248 User-Agent: s-nail v14.9.7
7251 From steffen Sun Feb 18 02:48:42 2018
7252 Date: Sun, 18 Feb 2018 02:48:42 +0100
7255 User-Agent: s-nail v14.9.7
7260 printf 'att2-1\natt2-2\natt2-4\n' > ./'.t 2'
7261 printf 'att3-1\natt3-2\natt3-4\n' > ./.t3
7262 printf 'att4-1\natt4-2\natt4-4\n' > './.t 4'
7265 '!@ ./.t3 "./.t 4" ""
7273 | ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" \
7274 -a ./.t1 -a './.t 2' \
7275 -s attachment-test \
7276 ex@am.ple > ./.tall 2>&1
7277 check 1 0 "${MBOX}" '2484200149 644'
7278 if have_feat uistrings; then
7279 check 2 - .tall '1928331872 720'
7281 t_echoskip '2:[!UISTRINGS]'
7287 !s This the subject is
7288 !@ ./.t3 "#2" "./.t 4" "#1" ""
7298 !@ ./.t3 "#2" "./.t 4" "#1" ""
7306 !@ ./.t3 "" "#2" "" "./.t 4" "" "#1" ""
7315 !@ ./.t3 "" "#2" "" "./.t 4" "" "#1" ""
7329 | ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" -Rf ./.tx \
7331 check 3 0 "${MBOX}" '3637385058 2335'
7332 if have_feat uistrings; then
7333 check 4 - .tall '2526106274 1910'
7335 t_echoskip '4:[!UISTRINGS]'
7364 | ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" -Rf ./.tx \
7366 check 5 0 "${MBOX}" '1604688179 2316'
7367 if have_feat uistrings; then
7368 check 6 - .tall '1210753005 508'
7370 t_echoskip '6:[!UISTRINGS]'
7376 </dev/null ${MAILX} ${ARGS} -Smta=test \
7377 -Sstealthmua=noagent -Shostname \
7378 -a ./.t1 -a './.t 2' \
7379 -a ./.t3 -a './.t 4' \
7381 ex@am.ple > ./.tall 2>&1
7382 check 7 0 .tall '1003537919 1262'
7385 </dev/null ${MAILX} ${ARGS} -Smta=test -Sttycharset=utf8 \
7386 -a ./.t1=ascii -a './.t 2'=LATin1 \
7387 -a ./.t3=UTF-8 -a './.t 4'=- \
7389 ex@am.ple > ./.tall 2>&1
7390 check 8 0 .tall '361641281 921'
7392 # input+output charset, no iconv
7393 </dev/null ${MAILX} ${ARGS} -Smta=test \
7394 -a ./.t1=ascii#- -a './.t 2'=LATin1#- \
7395 -a ./.t3=UTF-8#- -a './.t 4'=utf8#- \
7397 ex@am.ple > ./.tall 2>&1
7398 check 9 0 .tall '1357456844 933'
7400 if have_feat iconv; then
7401 printf 'ein \303\244ffchen und ein pferd\n' > .t10-f1
7402 if (< .t10-f1 iconv -f ascii -t utf8) >/dev/null 2>&1; then
7403 </dev/null ${MAILX} ${ARGS} --set mta=test \
7404 --set stealthmua=noagent --set hostname \
7405 --attach ./.t1=-#utf8 \
7406 --attach ./.t10-f1=utf8#latin1 \
7408 ex@am.ple > ./.tall 2>&1
7409 check 10 0 .tall '1257664842 877'
7411 t_echoskip '10:[ICONV/iconv(1):missing conversion(1)]'
7414 t_echoskip '10:[!ICONV]'
7421 # (after attachments)
7425 mkdir ./.ttt || exit 1
7429 : > 'diet\ is \curd.txt'
7430 : > 'diet "is" curd.txt'
7432 : > 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
7433 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
7434 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
7435 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
7437 echo bla | ${MAILX} ${ARGS} ${ADDARG_UNI} \
7438 -a "./.ttt/ma'ger.txt" -a "./.ttt/mä'ger.txt" \
7439 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is" curd.txt' \
7440 -a ./.ttt/höde-tröge.txt \
7441 -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 \
7442 -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 \
7443 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
7444 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
7446 check 1 0 "${MBOX}" '3720896054 3088'
7448 # `resend
' test, reusing $MBOX
7449 printf "Resend ./.t2\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
7450 check 2 0 ./.t2 '3720896054 3088'
7452 printf "resend ./.t3\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
7453 check 3 0 ./.t3 '3979736592 3133'
7455 # And a primitive test for reading messages with invalid parameters
7456 ${cat} <<-_EOT > ./.tinv
7457 From a@b.invalid Wed May 15 12:43:00 2018
7459 Content-Type: multipart/mixed; boundary="1"
7461 This is a multi-part message in MIME format.
7463 Content-Type: text/plain; charset=UTF-8
7464 Content-Transfer-Encoding: quoted-printable
7468 Content-Type: text/plain; name*17="na"; name*18="me-c-t"
7469 Content-Transfer-Encoding: 7bit
7470 Content-Disposition: inline
7475 From a@b.invalid Wed May 15 12:43:00 2018
7477 Content-Type: multipart/mixed; boundary="2"
7479 This is a multi-part message in MIME format.
7481 Content-Type: text/plain; charset=UTF-8
7482 Content-Transfer-Encoding: quoted-printable
7486 Content-Type: text/plain; name*17="na"; name*18="me-c-t"
7487 Content-Transfer-Encoding: 7bit
7488 Content-Disposition: inline;
7490 filename*998999999999999999999999999999="me-c-d"
7495 From a@b.invalid Wed May 15 12:43:00 2018
7497 Content-Type: multipart/mixed; boundary="3"
7499 This is a multi-part message in MIME format.
7501 Content-Type: text/plain; charset=UTF-8
7502 Content-Transfer-Encoding: quoted-printable
7506 Content-Type: text/plain; name*17="na"; name*18="me-c-t"
7507 Content-Transfer-Encoding: 7bit
7508 Content-Disposition: inline;
7509 filename*0="na"; filename*998="me-c-d"
7516 \\headerpick
type ignore Content-Type Content-Disposition
7519 ' | ${MAILX} ${ARGS} -Rf ./.tinv > ./.tall 2> ./.terr
7520 check 4 0 ./.tall '4094731083 905'
7521 if have_feat uistrings && have_feat iconv; then
7522 check 5 - ./.terr '3713266499 473'
7524 t_echoskip '5:[!UISTRINGS or
!ICONV
]'
7530 t_mime_types_load_control() {
7533 if have_feat uistrings; then :; else
7534 t_echoskip '[!UISTRINGS
]'
7539 ${cat} <<-_EOT > ./.tmts1
7540 ? application/mathml+xml mathml
7542 ${cat} <<-_EOT > ./.tmts2
7543 ? x-conference/x-cooltalk ice
7545 ? application/aga-aga aga
7548 ${cat} <<-_EOT > ./.tmts1.mathml
7549 <head>nonsense ML</head>
7551 ${cat} <<-_EOT > ./.tmts2.ice
7554 printf 'of
which the c
\x01rack is coming soon
' > ./.tmtsx.doom
7555 printf 'of
which the c
\x01rack is coming soon
' > ./.tmtsx.aga
7569 ' "${MBOX}" "${MBOX}" |
7571 -Smimetypes-load-control=f=./.tmts1,f=./.tmts2 \
7574 ${cat} "${MBOX}" >> ./.tout
7575 check 1 - ./.tout '2128819500 2441'
7577 echo type | ${MAILX} ${ARGS} -R \
7578 -Smimetypes-load-control=f=./.tmts1,f=./.tmts3 \
7579 -f "${MBOX}" >> ./.tout 2>&1
7580 check 2 0 ./.tout '1125106528 3642'
7586 # Around state machine, after basics {{{
7590 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" > ./.tall 2>&1
7591 commandalias x echo '$?
/$^ERRNAME
'
7592 commandalias y echo '$?
/$^ERRNAME
<$rv>'
7595 alternates a1@b1 a2@b2 a3@b3;x
7597 vput alternates rv;y
7601 vput alternates rv;y
7603 vput alternates rv;y
7605 vput alternates rv;y
7609 alternates a1@b1 a2@b2 a3@b3
7611 vput alternates rv;y
7613 vput alternates rv;y
7615 vput alternates rv;y
7618 alternates a1@b1 a2@b2 a3@b3
7620 vput alternates rv;y
7622 vput alternates rv;y
7624 vput alternates rv;y
7628 alternates a1@b1 a2@b2 a3@b3
7630 vput alternates rv;y
7634 alternates a1@b1 a1@c1 a1@d1 a2@b2 a3@b3 a3@c3 a3@d3
7636 ~s all alternates, only a1@b1 remains
7638 ~b a3@b3 a3@c3 a3@d3
7647 alternates a1@b1 a1@c1 a2@b2 a3@b3
7649 ~s a1@b1 a1@d1, and a3@c3 a3@d3 remain
7651 ~b a3@b3 a3@c3 a3@d3
7658 alternates a1@b1 a2@b2 a3; set allnet
7660 ~s all alternates via allnet, only a1@b1 remains
7662 ~b a3@b3 a3@c3 a3@d3
7671 vput alternates rv;y
7673 vput alternates rv;y
7675 vput alternates rv;y
7677 vput alternates rv;y
7680 vput alternates rv;y
7684 alternates a1@b1 a2@b2;x
7685 vput alternates rv;y
7686 alternates a3@b3 a4@b4;x
7687 vput alternates rv;y
7690 check 1 0 "${MBOX}" '3901995195 542'
7691 if have_feat uistrings; then
7692 check 2 - .tall '1878598364 505'
7694 t_echoskip '2:[!UISTRINGS
]'
7697 # Automatic alternates, also from command line (freezing etc.)
7699 ${cat} <<- __EOT > ./.tin
7700 From trouble-report@desy Wed Jun 6 20:19:28 2018
7701 Date: Wed, 06 Jun 2018 19:58:02 +0200
7702 From: a@b.org, b@b.org, c@c.org
7705 Cc: a@b.org, c@c.org
7707 Message-ID: <20180606175802.dw-cn%a@b.org>
7717 !^header remove subject
7718 !^header insert to b@b.org
7719 !^header insert cc
"a@b.org b@b.org c@c.org"
7722 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sescape=! \
7723 -S from=a@b.org,b@b.org,c@c.org -S sender=a@b.org \
7724 -Rf ./.tin > ./.tall 2>&1
7725 check 3 0 "${MBOX}" '3184203976 265'
7726 check 4 - .tall '3604001424 44'
7730 set from
=a@b.org
,b@b.org
,c@c.org sender
=a@b.org
7734 !^header remove subject
7735 !^header insert to b@b.org
7736 !^header insert cc
"a@b.org b@b.org c@c.org"
7739 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sescape=! \
7740 -Rf ./.tin > ./.tall 2>&1
7741 check 5 0 "${MBOX}" '98184290 530'
7742 check 6 - .tall '3604001424 44'
7744 # And more, with/out -r (and that Sender: vanishs as necessary)
7745 # TODO -r should be the Sender:, which should automatically propagate to
7746 # TODO From: if possible and/or necessary. It should be possible to
7747 # TODO suppres -r stuff from From: and Sender:, but fallback to special -r
7748 # TODO arg as appropriate.
7749 # TODO For now we are a bit messy
7752 </dev/null ${MAILX} ${ARGS} -Smta=test://"$MBOX" -s '-Sfrom + -r ++ test' \
7753 -c a@b.example -c b@b.example -c c@c.example \
7754 -S from=a@b.example,b@b.example,c@c.example \
7755 -S sender=a@b.example \
7756 -r a@b.example b@b.example ./.tout >./.tall 2>&1
7757 check 7 0 "${MBOX}" '4275947318 181'
7758 check 8 - .tout '4275947318 181'
7759 check 9 - .tall '4294967295 0'
7761 </dev/null ${MAILX} ${ARGS} -Smta=test://"$MBOX" -s '-Sfrom + -r ++ test' \
7762 -c a@b.example -c b@b.example -c c@c.example \
7763 -S from=a@b.example,b@b.example,c@c.example \
7764 -S sender=a2@b.example \
7765 -r a@b.example b@b.example ./.tout >./.tall 2>&1
7766 check 10 0 "${MBOX}" '1189494079 383'
7767 check 11 - .tout '1189494079 383'
7768 check 12 - .tall '4294967295 0'
7770 </dev/null ${MAILX} ${ARGS} -Smta=test://"$MBOX" -s '-Sfrom + -r ++ test' \
7771 -c a@b.example -c b@b.example -c c@c.example \
7772 -S from=a@b.example,b@b.example,c@c.example \
7773 -S sender=a@b.example \
7774 b@b.example >./.tall 2>&1
7775 check 13 0 "${MBOX}" '2253033142 610'
7776 check 14 - .tall '4294967295 0'
7782 # quote and cmd escapes because this (since Mail times) is worked in the
7783 # big collect() monster of functions
7786 echo 'included
file' > ./.ttxt
7787 { t__x1_msg && t__x2_msg && t__x3_msg &&
7788 t__gen_msg from 'ex4@am.ple
' subject sub4 &&
7789 t__gen_msg from 'eximan
<ex5@am.ple
>' subject sub5 &&
7790 t__gen_mimemsg from 'ex6@am.ple
' subject sub6; } > ./.tmbox
7791 check 1 - ./.tmbox '517368276 2182'
7793 # ~@ is tested with other attachment stuff, ~^ is in compose_edits + digmsg
7795 set Sign
=SignVar sign
=signvar DEAD
=.
/.ttxt
7796 set forward-inject-head quote-inject-head
7797 headerpick
type retain Subject
7798 headerpick forward retain Subject To
7800 !!1 Not escaped. And shell
test last
, right before
!..
7802 !: echo 2 only echoed via colon
7803 !:echo 2:$?
/$^ERRNAME
7804 !_
echo 3 only echoed via underscore
7805 !:echo 3:$?
/$^ERRNAME
7807 !:echo 4:$?
/$^ERRNAME
7808 !<! echo 5 shell
echo included
7809 !:echo 5:$?
/$^ERRNAME
7810 !|
echo 6 pipecmd-pre
; cat; echo 6 pipecmd-post
7811 !:echo 6:$?
/$^ERRNAME
7812 7 and
8 are ~A and ~a
:
7814 !:echo 7:$?
/$^ERRNAME
7816 !:echo 8:$?
/$^ERRNAME
7817 !b
9 added ~b cc
<ex1@am.ple
>
7818 !:echo 9:$?
/$^ERRNAME
7819 !c
10 added ~c c
<ex2@am.ple
>
7820 !:echo 10:$?
/$^ERRNAME
7823 !:echo 11:$?
/$^ERRNAME
7826 !:echo 12:$?
/$^ERRNAME
7829 !:echo 13:$?
/$^ERRNAME
7831 !:echo 13-1:$?
/$^ERRNAME
; set posix
7832 14: ~f
(headerpick
: subject
)
7834 !:echo 14:$?
/$^ERRNAME
; unset posix forward-inject-head quote-inject-head
7835 14.1: ~f
(!posix
: injections
; headerpick
: subject to
)
7837 !:echo 14.1:$?
/$^ERRNAME
; set forward-add-cc
7838 14.2: ~f
(!posix
: headerpick
: subject to
; forward-add-cc adds mr3
)
7840 !:echo 14.2:$?
/$^ERRNAME
; set fullnames
7841 14.3: ~f
(!posix
: headerpick
: subject to
; forward-add-cc adds mr1 fullname
)
7843 !:echo 14.3:$?
/$^ERRNAME
; set nofullnames noforward-add-cc posix
7846 !:echo 15:$?
/$^ERRNAME
7849 !:echo 15.5-1:$?
/$^ERRNAME
7851 !:echo 15.5-2:$?
/$^ERRNAME
7852 16, 17: ~I Sign
, ~i Sign
7854 !:echo 16:$?
/$^ERRNAME
7856 !:echo 17:$?
/$^ERRNAME
7859 !:echo 18:$?
/$^ERRNAME
# XXX forward-add-cc: not expl. tested
7862 !:echo 19:$?
/$^ERRNAME
7865 !:echo 20:$?
/$^ERRNAME
# XXX forward-add-cc: not expl. tested
7868 !:echo 21:$?
/$^ERRNAME
7869 !: # Initially ~Q was _exactly_ like
7870 28,29 nothing
, 30-34: ~Q
7871 !:echo quote
=<$quote>
7874 !:echo 30:$?
/$^ERRNAME
7877 !:echo 31:$?
/$^ERRNAME
7878 set quote-inject-head quote-inject-tail indentprefix
7879 !:wysh
set quote-inject-head
=%%a quote-inject-tail
=--%%r
7882 !:echo 32:$?
/$^ERRNAME
7883 set noquote-inject-head noquote-inject-tail quote-add-cc
7884 !:set noquote-inject-head noquote-inject-tail quote-add-cc
7887 !:echo 33:$?
/$^ERRNAME
7892 !:echo 34:$?
/$^ERRNAME
7893 unset fullnames
, quote stuff
7894 !:unset quote quote-add-cc fullnames
7897 !:echo 22:$?
/$^ERRNAME
7900 !:echo 23:$?
/$^ERRNAME
7901 24: ~s this new subject
7902 !s
24 did new ~s ubject
7903 !:echo 24:$?
/$^ERRNAME
7904 !t
25 added ~t o
<ex3@am.ple
>
7905 !:echo 25:$?
/$^ERRNAME
7908 !:echo 26.1:$?
/$^ERRNAME
7911 !:echo 26.2:$?
/$^ERRNAME
# XXX forward-add-cc: not expl. tested
7914 !:echo 27.1:$?
/$^ERRNAME
7917 !:echo 27.2:$?
/$^ERRNAME
# XXX forward-add-cc: not expl. tested
7918 and i ~w rite this out to .
/.tmsg
7920 !:echo i ~w
:$?
/$^ERRNAME
7921 !:wysh
set x
=$escape;set escape
=~
7922 ~
!echo shell
command output
7923 ~
:echo shell
:$?
/$^ERRNAME
7924 ~
:wysh
set escape
=$x
7927 !:echo 50 was F
:$?
/$^ERRNAME
7930 !:echo 51 was f
:$?
/$^ERRNAME
7933 !:echo 52 was M
:$?
/$^ERRNAME
7936 !:echo 53 was m
:$?
/$^ERRNAME
; set quote
7939 !:echo 54 was Q
:$?
/$^ERRNAME
7942 !:echo 55 was U
:$?
/$^ERRNAME
7945 !:echo 56 was u
:$?
/$^ERRNAME
7947 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Rf \
7948 -Sescape=! -Sindentprefix=' |
' \
7949 ./.tmbox >./.tall 2>./.terr
7951 ${cat} ./.tall >> "${MBOX}"
7952 check 2 - "${MBOX}" '3877629593 7699'
7954 if have_feat uistrings && have_feat iconv; then
7955 check 2-err - ./.terr '3575876476 49'
7957 t_echoskip '2-err:[!UISTRINGS or
!ICONV
]'
7959 check 3 - ./.tmsg '3502750368 4445'
7961 # Simple return/error value after *expandaddr* failure test
7964 !s This a new subject is
7965 !:set expandaddr
=-name
7974 !:alias abcc one@bcc.invalid
7977 !:set expandaddr
=+addr
7979 !:echo $
!/$?
/$^ERRNAME
7981 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
7983 -s testsub one@to.invalid >./.tall 2>&1
7984 check 4 0 "${MBOX}" '115245837 7900'
7985 if have_feat uistrings; then
7986 check 5 - ./.tall '2336041127 212'
7988 check 5 - ./.tall '1818580177 59'
7991 # Modifiers and whitespace indulgence
7993 !:remove
'"${MBOX}"'
8006 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
8009 -s testsub one@to.invalid >./.tall 2>./.terr
8010 check 6 4 ./.tall '686767281 95'
8011 [ -f "${MBOX}" ]; check_exn0 7
8012 if have_feat uistrings; then
8013 check 8 - ./.terr '1304637795 199'
8015 t_echoskip '8:[!UISTRINGS
]'
8021 t_compose_edits() { # XXX very rudimentary
8022 # after: t_cmd_escapes
8025 # Something to use as "editor"
8026 ${cat} <<-_EOT > ./.ted.sh
8028 ${cat} <<-__EOT > \${1}
8039 ${chmod} 0755 .ted.sh
8041 # > All these are in-a-row!
8043 printf 'mail .
/.tout
\n~s This subject is
\nThis body is
\n~.
' |
8044 ${MAILX} ${ARGS} -Seditheaders >./.tall 2>&1
8045 check 1 0 ./.tout '3993703854 127'
8046 check 2 - ./.tall '4294967295 0'
8048 ${mv} ./.tall ./.tout
8049 printf 'mail .
/.tout
\n~s This subject is
\nThis body is
\n~e
\n~.
' |
8050 ${MAILX} ${ARGS} -Seditheaders -SEDITOR=./.ted.sh >./.tall 2>&1
8051 check 3 0 ./.tout1 '285981670 116'
8052 check 4 - ./.tout2 '285981670 116'
8053 check 5 - ./.tout3 '285981670 116'
8054 check 6 - ./.tout '4294967295 0'
8055 check 7 - ./.tall '4294967295 0'
8056 ${rm} ./.tout1 ./.tout2 ./.tout3
8058 # Note t_compose_hooks adds ~^ stress tests
8059 ${mv} ./.tout ./.tout1
8060 ${mv} ./.tall ./.tout2
8062 mail .
/.tout
\n!s This subject is
\nThis body is
8068 !^header insert fcc .
/.tout
8069 !^header insert fcc .tout1
8070 !^header insert fcc .
/.tout2
8073 !^header remove-at fcc
2
8074 !^header remove-at fcc
2
8078 !^header insert fcc .
/.tout
8082 ' | ${MAILX} ${ARGS} -Sescape=! >./.tall 2>&1
8083 check 8 0 ./.tout '3993703854 127'
8084 check 9 - ./.tout1 '4294967295 0'
8085 check 10 - ./.tout2 '4294967295 0'
8086 check 11 - ./.tall '1857504914 342'
8088 # < No longer in-a-row
8090 ${cat} <<-_EOT | ${MAILX} ${ARGS} -t >./.tall 2>&1
8092 Subject: Fcc via -t test
8096 check 12 0 ./.ttout '1289478830 122'
8097 check 13 - ./.tall '4294967295 0'
8099 # This test assumes code of `^' and
`digmsg' is shared: see t_digmsg()
8100 echo 'b 1' > ./.t' x 1'
8101 echo 'b 2' > ./.t' x 2'
8104 !^header insert subject subject
8110 !^attachment insert "$i"
8116 !^attachment insert '"'"'./.t x 2'"'"'
8120 !^attachment remove "$i"
8124 !^attachment insert $'"'"'\\$i'"'"'
8132 !^a attribute-set "$i" filenames " cannot wait for you "
8136 !^a attribute-set "$i" filename " cannot wait for you "
8142 !^a attribute-set-at 2 "filename" "private eyes"
8146 !^a attribute-set-at 2 content-description "private c-desc"
8150 !^a attribute-set-at 2 content-ID "priv invd c-id"
8154 !^a attribute-set-at 2 content-TyPE tExT/mARkLO
8158 !^a attribute-set-at 2 content-TyPE ""
8163 ' | ${MAILX} ${ARGS} -Sescape=! >./.tall 2>&1
8164 check 14 0 ./.tall '3491667030 1565'
8165 check 15 - ./.tatt '1685063733 636'
8170 t_digmsg() { # XXX rudimentary; <> compose_edits()?
8174 mail ./.tout\n!s This subject is\nThis body is
8177 !:digmsg - header list
8178 !:digmsg - header show subject
8179 !:digmsg - header show to
8180 !:digmsg - header remove to
8181 !:digmsg - header list
8182 !:digmsg - header show to
8186 !:digmsg - header list; readall x; echon "<$x>";
8187 !:digmsg - header show subject;readall x;echon "<$x>";;
8190 !: # nothing here as is comment
8191 !^header insert fcc ./.tbox
8194 !:digmsg - header list
8195 !:digmsg - header show fcc
8199 !:digmsg - header list
8200 !:digmsg - header show fcc
8201 !:digmsg - header insert fcc ./.tfcc
8210 digmsg 1 header list
8211 digmsg 1 header show subject
8216 digmsg 1 header list; echo $?/$^ERRNAME
8217 digmsg create -; echo $?/$^ERRNAME
8219 ! %s ./.tfcc > ./.tcat
8220 ! %s "s/This subject is/There subject was/" < ./.tfcc >> ./.tcat
8222 mail nowhere@exam.ple
8224 !:digmsg create -; echo $?/$^ERRNAME;\\
8225 digmsg create 1; echo $?/$^ERRNAME;\\
8226 digmsg create 2; echo $?/$^ERRNAME
8228 !:digmsg - h l;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
8230 !:digmsg 1 h l;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
8234 !:digmsg 2 h l;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
8236 !:digmsg - h s to;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
8238 !:digmsg 1 h s subject;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
8242 !:digmsg 2 h s subject;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
8244 !:digmsg remove -; echo $?/$^ERRNAME;\\
8245 digmsg remove 1; echo $?/$^ERRNAME;\\
8246 digmsg remove 2; echo $?/$^ERRNAME;
8248 echo ======= new game new fun!
8251 !:set expandaddr=-name
8253 !^ header insert to two@to.invalid
8256 !^ header insert cc no-name-allowed
8258 !^ header insert cc one@cc.invalid
8261 !:alias abcc one@bcc.invalid
8262 !^ header insert bcc abcc
8264 !:set expandaddr=+addr
8265 !^ header insert bcc abcc
8266 !:echo $!/$?/$^ERRNAME
8269 ' "${cat}" "${sed}" |
8270 ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sescape=! >./.tall 2>&1
8271 check 1 0 "$MBOX" '665881681 179'
8272 have_feat uistrings && i='4159482825 1372' || i='2254509488 1103'
8273 check 2 - ./.tall "${i}"
8274 check 3 - ./.tfcc '3993703854 127'
8275 check 4 - ./.tempty '4294967295 0'
8276 check 5 - ./.tcat '2157992522 256'
8281 t_on_main_loop_tick() {
8284 if have_feat cmd-vexpr; then :; else
8285 t_echoskip '[!CMD_VEXPR]'
8301 set on-main-loop-tick=omlt
8304 echo calling bla;call bla
8307 ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sescape=! >./.tall 2>&1
8308 check 1 0 ./.tall '3697651500 130'
8313 t_on_program_exit() {
8317 -X 'define x {' -X 'echo jay' -X '}' -X x -Son-program-exit=x \
8319 check 1 0 ./.tall '2820891503 4'
8322 -X 'define x {' -X 'echo jay' -X '}' -X q -Son-program-exit=x \
8324 check 2 0 ./.tall '2820891503 4'
8326 </dev/null ${MAILX} ${ARGS} \
8327 -X 'define x {' -X 'echo jay' -X '}' -Son-program-exit=x \
8329 check 3 0 ./.tall '2820891503 4'
8331 </dev/null ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
8332 -X 'define x {' -X 'echo jay' -X '}' -Son-program-exit=x \
8333 -s subject -. hey@you \
8335 check 4 0 ./.tall '2820891503 4'
8336 check 5 - "$MBOX" '561900352 118'
8342 # Heavy use of/rely on state machine (behaviour) and basics {{{
8343 t_compose_hooks() { # {{{ TODO monster
8346 if have_feat uistrings &&
8347 have_feat cmd-csop && have_feat cmd-vexpr; then :; else
8348 t_echoskip '[!UISTRINGS/!CMD_CSOP/!CMD_VEXPR]'
8353 (echo line one&&echo line two&&echo line three) > ./.treadctl
8354 (echo echo four&&echo echo five&&echo echo six) > ./.tattach
8356 # Supposed to extend t_compose_edits with ~^ stress tests!
8357 ${cat} <<'__EOT__' > ./.trc
8359 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
8362 vput csop es substr "$1" 0 1
8367 define read_mline_res {
8368 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
8369 echo $len/$es/$^ERRNAME: $hl
8370 if [ $es -ne $^ERR-NONE ]
8371 xcall bail read_mline_res
8373 \xcall read_mline_res
8378 echo "~^header list"; read hl; echo $hl;\
8379 call xerr "$hl" "in_addr ($xh) 0-1"
8381 echo "~^header insert $xh 'diet <$xh@exam.ple> spliced'";\
8382 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
8383 echo "~^header insert $xh <${xh}2@exam.ple>";\
8384 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
8385 echo "~^header insert $xh ${xh}3@exam.ple";\
8386 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
8387 echo "~^header list $xh"; read hl; echo $hl;\
8388 call xerr "$hl" "ins_addr $xh 1-4"
8389 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
8392 if [ "$t_remove" == "" ]
8396 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
8397 echo "~^header remove $xh"; read es; vput csop es substr $es 0 3
8399 xcall bail "ins_addr $xh 2-2"
8401 echo "~^header list $xh"; read es; vput csop es substr $es 0 3
8403 xcall bail "ins_addr $xh 2-3"
8405 echo "~^header show $xh"; read es; vput csop es substr $es 0 3
8407 xcall bail "ins_addr $xh 2-4"
8411 echo "~^header insert $xh 'diet <$xh@exam.ple> spliced'";\
8412 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
8413 echo "~^header insert $xh <${xh}2@exam.ple>";\
8414 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
8415 echo "~^header insert $xh ${xh}3@exam.ple";\
8416 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
8417 echo "~^header list $xh"; read hl; echo $hl;\
8418 call xerr "$hl" "ins_addr $xh 3-4"
8419 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
8422 echo "~^header remove-at $xh 1"; read es;\
8423 call xerr $es "ins_addr $xh 3-6"
8424 echo "~^header remove-at $xh 1"; read es;\
8425 call xerr $es "ins_addr $xh 3-7"
8426 echo "~^header remove-at $xh 1"; read es;\
8427 call xerr $es "ins_addr $xh 3-8"
8428 echo "~^header remove-at $xh 1"; read es;\
8429 vput csop es substr $es 0 3
8431 xcall bail "ins_addr $xh 3-9"
8433 echo "~^header remove-at $xh T"; read es;\
8434 vput csop es substr $es 0 3
8436 xcall bail "ins_addr $xh 3-10"
8438 echo "~^header list $xh"; read es;\
8439 vput csop es substr $es 0 3
8441 xcall bail "ins_addr $xh 3-11"
8443 echo "~^header show $xh"; read es;\
8444 vput csop es substr $es 0 3
8446 xcall bail "ins_addr $xh 3-12"
8450 echo "~^header insert $xh 'diet <$xh@exam.ple> spliced'";\
8451 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
8452 echo "~^header insert $xh <${xh}2@exam.ple>\ (comment)\ \\\"Quot(e)d\\\"";\
8453 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
8454 echo "~^header insert $xh ${xh}3@exam.ple";\
8455 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
8456 echo "~^header list $xh"; read hl; echo $hl;\
8457 call xerr "$hl" "header list $xh 3-4"
8458 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
8461 echo "~^header remove-at $xh 3"; read es;\
8462 call xerr $es "ins_addr $xh 4-6"
8463 echo "~^header remove-at $xh 2"; read es;\
8464 call xerr $es "ins_addr $xh 4-7"
8465 echo "~^header remove-at $xh 1"; read es;\
8466 call xerr $es "ins_addr $xh 4-8"
8467 echo "~^header remove-at $xh 1"; read es;\
8468 vput csop es substr $es 0 3
8470 xcall bail "ins_addr $xh 4-9"
8472 echo "~^header remove-at $xh T"; read es;\
8473 vput csop es substr $es 0 3
8475 xcall bail "ins_addr $xh 4-10"
8477 echo "~^header list $xh"; read es;\
8478 vput csop es substr $es 0 3
8480 xcall bail "ins_addr $xh 4-11"
8482 echo "~^header show $xh"; read es;\
8483 vput csop es substr $es 0 3
8485 xcall bail "ins_addr $xh 4-12"
8489 wysh set xh=$1 mult=$2
8490 echo "~^header list"; read hl; echo $hl;\
8491 call xerr "$hl" "ins_ref ($xh) 0-1"
8493 echo "~^header insert $xh <$xh@exam.ple>";\
8494 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
8496 echo "~^header insert $xh <${xh}2@exam.ple>";\
8497 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
8498 echo "~^header insert $xh ${xh}3@exam.ple";\
8499 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
8501 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
8502 vput csop es substr $es 0 3
8504 xcall bail "ins_ref $xh 1-4"
8508 echo "~^header list $xh"; read hl; echo $hl;\
8509 call xerr "$hl" "ins_ref $xh 1-5"
8510 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
8513 if [ "$t_remove" == "" ]
8517 echo "~^header remove $xh"; read es;\
8518 call xerr $es "ins_ref $xh 2-1"
8519 echo "~^header remove $xh"; read es;\
8520 vput csop es substr $es 0 3
8522 xcall bail "ins_ref $xh 2-2"
8524 echo "~^header list $xh"; read es;\
8525 vput csop es substr $es 0 3
8527 xcall bail "$es ins_ref $xh 2-3"
8529 echo "~^header show $xh"; read es;\
8530 vput csop es substr $es 0 3
8532 xcall bail "ins_ref $xh 2-4"
8536 echo "~^header insert $xh <$xh@exam.ple>";\
8537 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
8539 echo "~^header insert $xh <${xh}2@exam.ple>";\
8540 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
8541 echo "~^header insert $xh ${xh}3@exam.ple";\
8542 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
8544 echo "~^header list $xh";\
8545 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
8546 echo "~^header show $xh";\
8547 read es; call xerr $es "ins_ref $xh 3-5"
8550 echo "~^header remove-at $xh 1"; read es;\
8551 call xerr $es "ins_ref $xh 3-6"
8552 if [ $mult -ne 0 ] && [ $xh != subject ]
8553 echo "~^header remove-at $xh 1"; read es;\
8554 call xerr $es "ins_ref $xh 3-7"
8555 echo "~^header remove-at $xh 1"; read es;\
8556 call xerr $es "ins_ref $xh 3-8"
8558 echo "~^header remove-at $xh 1"; read es;\
8559 vput csop es substr $es 0 3
8561 xcall bail "ins_ref $xh 3-9"
8563 echo "~^header remove-at $xh T"; read es;\
8564 vput csop es substr $es 0 3
8566 xcall bail "ins_ref $xh 3-10"
8568 echo "~^header show $xh"; read es;\
8569 vput csop es substr $es 0 3
8571 xcall bail "ins_ref $xh 3-11"
8575 echo "~^header insert $xh <$xh@exam.ple> ";\
8576 read es; echo $es; call xerr "$es" "ins_ref $xh 4-1"
8578 echo "~^header insert $xh <${xh}2@exam.ple> ";\
8579 read es; echo $es; call xerr "$es" "ins_ref $xh 4-2"
8580 echo "~^header insert $xh ${xh}3@exam.ple";\
8581 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
8583 echo "~^header list $xh"; read hl; echo $hl;\
8584 call xerr "$hl" "ins_ref $xh 4-4"
8585 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
8588 if [ $mult -ne 0 ] && [ $xh != subject ]
8589 echo "~^header remove-at $xh 3"; read es;\
8590 call xerr $es "ins_ref $xh 4-6"
8591 echo "~^header remove-at $xh 2"; read es;\
8592 call xerr $es "ins_ref $xh 4-7"
8594 echo "~^header remove-at $xh 1"; read es;\
8595 call xerr $es "ins_ref $xh 4-8"
8596 echo "~^header remove-at $xh 1"; read es;\
8597 vput csop es substr $es 0 3
8599 xcall bail "ins_ref $xh 4-9"
8601 echo "~^header remove-at $xh T"; read es;\
8602 vput csop es substr $es 0 3
8604 xcall bail "ins_ref $xh 4-10"
8606 echo "~^header show $xh"; read es;\
8607 vput csop es substr $es 0 3
8609 xcall bail "ins_ref $xh 4-11"
8614 # In collect.c order
8616 call ins_ref sender 0 # Not a "ref", but works
8620 call ins_addr reply-To
8621 call ins_addr mail-Followup-to
8622 call ins_ref messAge-id 0
8623 call ins_ref rEfErEncEs 1
8624 call ins_ref in-Reply-to 1
8625 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
8626 call ins_addr freeForm1
8627 call ins_addr freeform2
8629 echo "~^header show MAILX-Command"; read es; call xerr $es "t_header 1000"
8631 echo "~^header show MAILX-raw-TO"; read es; call xerr $es "t_header 1001"
8639 echo "~^attachment";\
8640 read hl; echo $hl; vput csop es substr "$hl" 0 3
8642 xcall bail "attach 0-1"
8645 echo "~^attach attribute ./.treadctl";\
8646 read hl; echo $hl; vput csop es substr "$hl" 0 3
8648 xcall bail "attach 0-2"
8650 echo "~^attachment attribute-at 1";\
8651 read hl; echo $hl; vput csop es substr "$hl" 0 3
8653 xcall bail "attach 0-3"
8656 echo "~^attachment insert ./.treadctl=ascii";\
8657 read hl; echo $hl; call xerr "$hl" "attach 1-1"
8658 echo "~^attachment list";\
8659 read es; echo $es;call xerr "$es" "attach 1-2"
8661 echo "~^attachment attribute ./.treadctl";\
8662 read es; echo $es;call xerr "$es" "attach 1-3"
8664 echo "~^attachment attribute .treadctl";\
8665 read es; echo $es;call xerr "$es" "attach 1-4"
8667 echo "~^attachment attribute-at 1";\
8668 read es; echo $es;call xerr "$es" "attach 1-5"
8671 echo "~^attachment attribute-set ./.treadctl filename rctl";\
8672 read es; echo $es;call xerr "$es" "attach 1-6"
8673 echo "~^attachment attribute-set .treadctl content-description Au";\
8674 read es; echo $es;call xerr "$es" "attach 1-7"
8675 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
8676 read es; echo $es;call xerr "$es" "attach 1-8"
8678 echo "~^attachment attribute ./.treadctl";\
8679 read es; echo $es;call xerr "$es" "attach 1-9"
8681 echo "~^attachment attribute .treadctl";\
8682 read es; echo $es;call xerr "$es" "attach 1-10"
8684 echo "~^attachment attribute rctl";\
8685 read es; echo $es;call xerr "$es" "attach 1-11"
8687 echo "~^attachment attribute-at 1";\
8688 read es; echo $es;call xerr "$es" "attach 1-12"
8692 echo "~^attachment insert ./.tattach=latin1";\
8693 read hl; echo $hl; call xerr "$hl" "attach 2-1"
8694 echo "~^attachment list";\
8695 read es; echo $es;call xerr "$es" "attach 2-2"
8697 echo "~^attachment attribute ./.tattach";\
8698 read es; echo $es;call xerr "$es" "attach 2-3"
8700 echo "~^attachment attribute .tattach";\
8701 read es; echo $es;call xerr "$es" "attach 2-4"
8703 echo "~^attachment attribute-at 2";\
8704 read es; echo $es;call xerr "$es" "attach 2-5"
8707 echo "~^attachment attribute-set ./.tattach filename tat";\
8708 read es; echo $es;call xerr "$es" "attach 2-6"
8710 "~^attachment attribute-set .tattach content-description Au2";\
8711 read es; echo $es;call xerr "$es" "attach 2-7"
8712 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
8713 read es; echo $es;call xerr "$es" "attach 2-8"
8715 "~^attachment attribute-set-at 2 content-type application/x-sh";\
8716 read es; echo $es;call xerr "$es" "attach 2-9"
8718 echo "~^attachment attribute ./.tattach";\
8719 read es; echo $es;call xerr "$es" "attach 2-10"
8721 echo "~^attachment attribute .tattach";\
8722 read es; echo $es;call xerr "$es" "attach 2-11"
8724 echo "~^attachment attribute tat";\
8725 read es; echo $es;call xerr "$es" "attach 2-12"
8727 echo "~^attachment attribute-at 2";\
8728 read es; echo $es;call xerr "$es" "attach 2-13"
8732 if [ "$t_remove" == "" ]
8736 echo "~^attachment remove ./.treadctl"; read es;\
8737 call xerr $es "attach 3-1"
8738 echo "~^attachment remove ./.tattach"; read es;\
8739 call xerr $es "attach 3-2"
8740 echo "~^ attachment remove ./.treadctl"; read es;\
8741 vput csop es substr $es 0 3
8743 xcall bail "attach 3-3"
8745 echo "~^ attachment remove ./.tattach"; read es;\
8746 vput csop es substr $es 0 3
8748 xcall bail "attach 3-4"
8750 echo "~^attachment list"; read es;\
8751 vput csop es substr $es 0 3
8753 xcall bail "attach 3-5"
8757 echo "~^attachment insert ./.tattach=latin1";\
8758 read hl; echo $hl; call xerr "$hl" "attach 4-1"
8759 echo "~^attachment insert ./.tattach=latin1";\
8760 read hl; echo $hl; call xerr "$hl" "attach 4-2"
8761 echo "~^attachment list";\
8762 read es; echo $es;call xerr "$es" "attach 4-3"
8764 echo "~^ attachment remove .tattach"; read es;\
8765 vput csop es substr $es 0 3
8767 xcall bail "attach 4-4 $es"
8769 echo "~^attachment remove-at T"; read es;\
8770 vput csop es substr $es 0 3
8772 xcall bail "attach 4-5"
8774 echo "~^attachment remove ./.tattach"; read es;\
8775 call xerr $es "attach 4-6"
8776 echo "~^attachment remove ./.tattach"; read es;\
8777 call xerr $es "attach 4-7"
8778 echo "~^ attachment remove ./.tattach"; read es;\
8779 vput csop es substr $es 0 3
8781 xcall bail "attach 4-8 $es"
8783 echo "~^attachment list"; read es;\
8784 vput csop es substr $es 0 3
8786 xcall bail "attach 4-9"
8790 echo "~^attachment insert ./.tattach=latin1";\
8791 read hl; echo $hl; call xerr "$hl" "attach 5-1"
8792 echo "~^attachment insert ./.tattach=latin1";\
8793 read hl; echo $hl; call xerr "$hl" "attach 5-2"
8794 echo "~^attachment insert ./.tattach=latin1";\
8795 read hl; echo $hl; call xerr "$hl" "attach 5-3"
8796 echo "~^attachment list";\
8797 read es; echo $es;call xerr "$es" "attach 5-4"
8800 echo "~^attachment remove-at 3"; read es;\
8801 call xerr $es "attach 5-5"
8802 echo "~^attachment remove-at 3"; read es;\
8803 vput csop es substr $es 0 3
8805 xcall bail "attach 5-6"
8807 echo "~^attachment remove-at 2"; read es;\
8808 call xerr $es "attach 5-7"
8809 echo "~^attachment remove-at 2"; read es;\
8810 vput csop es substr $es 0 3
8812 xcall bail "attach 5-8"
8814 echo "~^attachment remove-at 1"; read es;\
8815 call xerr $es "attach 5-9"
8816 echo "~^attachment remove-at 1"; read es;\
8817 vput csop es substr $es 0 3
8819 xcall bail "attach 5-10"
8822 echo "~^attachment list"; read es;\
8823 vput csop es substr $es 0 3
8825 xcall bail "attach 5-11"
8829 echo "~^attachment insert ./.tattach=latin1";\
8830 read hl; echo $hl; call xerr "$hl" "attach 6-1"
8831 echo "~^attachment insert ./.tattach=latin1";\
8832 read hl; echo $hl; call xerr "$hl" "attach 6-2"
8833 echo "~^attachment insert ./.tattach=latin1";\
8834 read hl; echo $hl; call xerr "$hl" "attach 6-3"
8835 echo "~^attachment list";\
8836 read es; echo $es;call xerr "$es" "attach 6-4"
8839 echo "~^attachment remove-at 1"; read es;\
8840 call xerr $es "attach 6-5"
8841 echo "~^attachment remove-at 1"; read es;\
8842 call xerr $es "attach 6-6"
8843 echo "~^attachment remove-at 1"; read es;\
8844 call xerr $es "attach 6-7"
8845 echo "~^attachment remove-at 1"; read es;\
8846 vput csop es substr $es 0 3
8848 xcall bail "attach 6-8"
8851 echo "~^attachment list"; read es;\
8852 vput csop es substr $es 0 3
8854 xcall bail "attach 6-9"
8866 echo on-compose-enter, mailx-command<$mailx-command>
8867 alternates alter1@exam.ple alter2@exam.ple
8869 set autocc='alter1@exam.ple alter2@exam.ple'
8870 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
8871 echo mailx-subject<$mailx-subject>
8872 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
8873 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
8874 mailx-raw-bcc<$mailx-raw-bcc>
8875 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
8876 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
8877 digmsg create - -;echo $?/$!/$^ERRNAME;\
8878 digmsg - header list;\
8879 digmsg remove -;echo $?/$!/$^ERRNAME
8880 digmsg create -;echo $?/$!/$^ERRNAME;\
8881 digmsg - header list;readall x;echon $x;\
8882 digmsg remove -;echo $?/$!/$^ERRNAME
8885 echo on-compose-leave, mailx-command<$mailx-command>
8887 eval alternates $al alter3@exam.ple alter4@exam.ple
8889 set autobcc='alter3@exam.ple alter4@exam.ple'
8890 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
8891 echo mailx-subject<$mailx-subject>
8892 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
8893 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
8894 mailx-raw-bcc<$mailx-raw-bcc>
8895 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
8896 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
8897 digmsg create - -;echo $?/$!/$^ERRNAME;\
8898 digmsg - header list;\
8899 digmsg remove -;echo $?/$!/$^ERRNAME
8900 digmsg create -;echo $?/$!/$^ERRNAME;\
8901 digmsg - header list;readall x;echon $x;\
8902 digmsg remove -;echo $?/$!/$^ERRNAME
8905 echo on-compose-cleanup, mailx-command<$mailx-command>
8908 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
8909 echo mailx-subject<$mailx-subject>
8910 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
8911 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
8912 mailx-raw-bcc<$mailx-raw-bcc>
8913 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
8914 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
8915 # XXX error message variable digmsg create - -;echo $?/$!/$^ERRNAME;\
8916 digmsg - header list;\
8917 digmsg remove -;echo $?/$!/$^ERRNAME
8918 # ditto digmsg create -;echo $?/$!/$^ERRNAME;\
8919 digmsg - header list;readall x;echon $x;\
8920 digmsg remove -;echo $?/$!/$^ERRNAME
8922 wysh set on-compose-splice=t_ocs \
8923 on-compose-enter=t_oce on-compose-leave=t_ocl \
8924 on-compose-cleanup=t_occ
8927 printf 'm this-goes@nowhere\nbody\n!.\n' |
8928 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
8929 -X'source ./.trc' -Smta=test://"$MBOX" \
8931 ${cat} ./.tall >> "${MBOX}"
8932 check 1 0 "${MBOX}" '1646284089 10565'
8935 printf 'm this-goes@nowhere\nbody\n!.\n' |
8936 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
8937 -St_remove=1 -X'source ./.trc' -Smta=test://"$MBOX" \
8939 ${cat} ./.tall >> "${MBOX}"
8940 check 2 0 "${MBOX}" '700681006 12851'
8944 # Some state machine stress, shell compose hook, localopts for hook, etc.
8945 # readctl in child. ~r as HERE document
8947 printf 'm ex@am.ple\nbody\n!.
8948 echon ${mailx-command}${mailx-subject}
8949 echon ${mailx-from}${mailx-sender}
8950 echon ${mailx-to}${mailx-cc}${mailx-bcc}
8951 echon ${mailx-raw-to}${mailx-raw-cc}${mailx-raw-bcc}
8952 echon ${mailx-orig-from}${mailx-orig-to}${mailx-orig-gcc}${mailx-orig-bcc}
8953 var t_oce t_ocs t_ocs_sh t_ocl t_occ autocc
8954 ' | ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
8955 -Smta=test://"$MBOX" \
8958 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
8961 vput csop es substr "$1" 0 1
8966 define read_mline_res {
8967 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
8968 echo $len/$es/$^ERRNAME: $hl
8969 if [ $es -ne $^ERR-NONE ]
8970 xcall bail read_mline_res
8972 \xcall read_mline_res
8976 vput vexpr i + 1 "$2"
8978 vput vexpr j % $i 10
8985 eval \\$j _work $1 $i
8988 vput vexpr i + $i "$1"
8992 wysh set line; read line;wysh set es=$? en=$^ERRNAME ;\
8993 echo read:$es/$en: $line
8994 if [ "${es}" -ne -1 ]
8997 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
9002 echo "~^header list"; read hl; echo $hl;\
9003 vput csop es substr "$hl" 0 1
9005 xcall bail "header list"
9008 call _work 1; echo $?
9009 echo "~^header insert cc splicy\ diet\ <splice@exam.ple>\ spliced";\
9010 read es; echo $es; vput csop es substr "$es" 0 1
9012 xcall bail "be diet"
9014 echo "~^header insert cc <splice2@exam.ple>";\
9015 read es; echo $es; vput csop es substr "$es" 0 1
9017 xcall bail "be diet2"
9020 call _work 2; echo $?
9021 echo "~^header insert bcc juicy\ juice\ <juice@exam.ple>\ spliced";\
9022 read es; echo $es;vput csop es substr "$es" 0 1
9024 xcall bail "be juicy"
9026 echo "~^header insert bcc juice2@exam.ple";\
9027 read es; echo $es;vput csop es substr "$es" 0 1
9029 xcall bail "be juicy2"
9031 echo "~^header insert bcc juice3\ <juice3@exam.ple>";\
9032 read es; echo $es;vput csop es substr "$es" 0 1
9034 xcall bail "be juicy3"
9036 echo "~^header insert bcc juice4@exam.ple";\
9037 read es; echo $es;vput csop es substr "$es" 0 1
9039 xcall bail "be juicy4"
9042 echo "~^header remove-at bcc 3";\
9043 read es; echo $es;vput csop es substr "$es" 0 1
9045 xcall bail "remove juicy5"
9047 echo "~^header remove-at bcc 2";\
9048 read es; echo $es;vput csop es substr "$es" 0 1
9050 xcall bail "remove juicy6"
9052 echo "~^header remove-at bcc 3";\
9053 read es; echo $es;vput csop es substr "$es" 0 3
9055 xcall bail "failed to remove-at"
9057 # Add duplicates which ought to be removed!
9058 echo "~^header insert bcc juice4@exam.ple";\
9059 read es; echo $es;vput csop es substr "$es" 0 1
9061 xcall bail "be juicy4-1"
9063 echo "~^header insert bcc juice4@exam.ple";\
9064 read es; echo $es;vput csop es substr "$es" 0 1
9066 xcall bail "be juicy4-2"
9068 echo "~^header insert bcc juice4@exam.ple";\
9069 read es; echo $es;vput csop es substr "$es" 0 1
9071 xcall bail "be juicy4-3"
9076 call _work 3; echo $?
9078 vput ! i echo just knock if you can hear me;\
9080 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
9082 echon shell-cmd says $?/$^ERRNAME: $i
9083 echo "~x will not become interpreted, we are reading until __EOT"
9085 read r_status; echo "~~r status output: $r_status"
9086 echo "~:echo $? $! $^ERRNAME"
9088 echo "~~r status from parent: $r_status"
9091 call _work 4; echo $?
9092 vput cwd cwd;echo cwd:$?
9093 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME;\
9097 call _work 5; echo $?
9098 echo "~^header show MAILX-Command"; read es;\
9099 call xerr $es "t_header 1000"; call read_mline_res
9100 echo "~^header show MAILX-raw-TO"; read es;\
9101 call xerr $es "t_header 1001"; xcall read_mline_res
9103 echoerr IT IS WRONG IF YOU SEE THIS
9106 echo on-compose-enter, mailx-command<$mailx-command>
9107 set t_oce autobcc=oce@exam.ple
9108 alternates alter1@exam.ple alter2@exam.ple
9110 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
9111 echo mailx-subject<$mailx-subject>
9112 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
9113 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
9114 mailx-raw-bcc<$mailx-raw-bcc>
9115 echo mailx-orig-from<$mailx-orig-from> \
9116 mailx-orig-to<$mailx-orig-to> \
9117 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
9120 echo on-compose-leave, mailx-command<$mailx-command>
9121 set t_ocl autocc=ocl@exam.ple
9123 alternates alter3@exam.ple alter4@exam.ple
9125 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
9126 echo mailx-subject<$mailx-subject>
9127 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
9128 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
9129 mailx-raw-bcc<$mailx-raw-bcc>
9130 echo mailx-orig-from<$mailx-orig-from> \
9131 mailx-orig-to<$mailx-orig-to> \
9132 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
9135 echo on-compose-cleanup, mailx-command<$mailx-command>
9136 set t_occ autocc=occ@exam.ple
9139 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
9140 echo mailx-subject<$mailx-subject>
9141 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
9142 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
9143 mailx-raw-bcc<$mailx-raw-bcc>
9144 echo mailx-orig-from<$mailx-orig-from> \
9145 mailx-orig-to<$mailx-orig-to> \
9146 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
9148 wysh set on-compose-splice=t_ocs \
9149 on-compose-splice-shell="read ver;echo t_ocs-shell;\
9150 echo \"~t shell@exam.ple\"; echo \"~:set t_ocs_sh\"" \
9151 on-compose-enter=t_oce on-compose-leave=t_ocl \
9152 on-compose-cleanup=t_occ
9155 ${cat} ./.tnotes >> "${MBOX}"
9156 check 3 - "${MBOX}" '3986011319 2437'
9158 # Reply, forward, resend, Resend
9166 set from="du <f2@z>" stealthmua=noagent
9170 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Snomemdebug -Sescape=! \
9172 check_ex0 4-intro-estat
9175 echo start: $? $! $^ERRNAME
9177 echo File: $? $! $^ERRNAME;echo;echo
9179 this is content of reply 1
9181 echo reply 1: $? $! $^ERRNAME;echo;echo
9183 this is content of Reply 1 2
9185 echo Reply 1 2: $? $! $^ERRNAME;echo;echo
9186 forward 1 fwdex@am.ple
9187 this is content of forward 1
9189 echo forward 1: $? $! $^ERRNAME;echo;echo
9190 wysh set forward-inject-head=$'"'"'-- \\
9191 forward (%%a)(%%d)(%%f)(%%i)(%%n)(%%r) --\\n'"'"'
9192 wysh set forward-inject-tail=$'"'"'-- \\
9193 end of forward (%%i) --\\n'"'"'
9194 forward 2 fwdex@am.ple
9195 this is content of forward 2
9197 echo forward 2: $? $! $^ERRNAME;echo;echo
9199 forward 2 fwdex2@am.ple
9200 this is content of forward 2, 2nd, with showname set
9202 echo forward 2, 2nd: $? $! $^ERRNAME;echo;echo
9203 resend 1 2 resendex@am.ple
9204 echo resend 1 2: $? $! $^ERRNAME;echo;echo
9205 Resend 1 2 Resendex@am.ple
9206 echo Resend 1 2: $? $! $^ERRNAME;echo;echo
9208 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sfullnames \
9209 -Smta=test://"$MBOX" \
9212 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
9215 vput csop es substr "$1" 0 1
9220 define read_mline_res {
9221 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
9222 echo mline_res:$len/$es/$^ERRNAME: $hl
9223 if [ $es -ne $^ERR-NONE ]
9224 xcall bail read_mline_res
9226 \xcall read_mline_res
9230 echo "~^header show $1"; read es;\
9231 call xerr $es "work_hl $1"; echo $1; call read_mline_res
9239 echo t_ocs version $ver
9240 echo "~^header list"; read hl; echo $hl;\
9241 echoerr the header list is $hl;\
9242 call xerr "$hl" "header list"
9243 eval vpospar set $hl
9246 echoerr IT IS WRONG IF YOU SEE THIS
9249 echo on-XY-enter, mailx-command<$mailx-command>
9250 set t_oce autobcc=oce@exam.ple
9251 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
9252 echo mailx-subject<$mailx-subject>
9253 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
9254 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
9255 mailx-raw-bcc<$mailx-raw-bcc>
9256 echo mailx-orig-from<$mailx-orig-from> \
9257 mailx-orig-to<$mailx-orig-to> \
9258 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
9261 echo on-XY-leave, mailx-command<$mailx-command>
9262 set t_ocl autocc=ocl@exam.ple
9263 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
9264 echo mailx-subject<$mailx-subject>
9265 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
9266 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
9267 mailx-raw-bcc<$mailx-raw-bcc>
9268 echo mailx-orig-from<$mailx-orig-from> \
9269 mailx-orig-to<$mailx-orig-to> \
9270 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
9273 echo on-XY-cleanup, mailx-command<$mailx-command>
9274 set t_occ autocc=occ@exam.ple
9275 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
9276 echo mailx-subject<$mailx-subject>
9277 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
9278 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
9279 mailx-raw-bcc<$mailx-raw-bcc>
9280 echo mailx-orig-from<$mailx-orig-from> \
9281 mailx-orig-to<$mailx-orig-to> \
9282 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
9284 wysh set on-compose-splice=t_ocs \
9285 on-compose-enter=t_oce on-compose-leave=t_ocl \
9286 on-compose-cleanup=t_occ \
9287 on-resend-enter=t_oce on-resend-cleanup=t_occ
9290 ${cat} ./.tnotes >> "${MBOX}"
9291 check 4 - "${MBOX}" '1850092468 11799'
9296 t_mass_recipients() {
9299 if have_feat cmd-vexpr; then :; else
9300 t_echoskip '[!CMD_VEXPR]'
9305 ${cat} <<'__EOT__' > ./.trc
9307 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
9310 wysh set nr=$1 hn=$2
9311 echo "~$hn $hn$nr@$hn"; echo '~:echo $?'; read es
9313 xcall bail "ins_addr $hn 1-$nr"
9315 vput vexpr nr + $nr 1
9316 if [ "$nr" -le "$maximum" ]
9317 xcall ins_addr $nr $hn
9321 wysh set nr=$1 hn=$2
9322 alternates $hn$nr@$hn
9323 vput vexpr nr + $nr 2
9324 if [ "$nr" -le "$maximum" ]
9325 xcall bld_alter $nr $hn
9335 if [ "$t_remove" != '' ]
9340 set on-compose-splice=t_ocs on-compose-leave=t_ocl
9343 printf 'm this-goes@nowhere\nbody\n!.\n' |
9344 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
9345 -X'source ./.trc' -Smta=test://"$MBOX" -Smaximum=${LOOPS_MAX} \
9348 ${cat} ./.tall >> "${MBOX}"
9349 if [ ${LOOPS_MAX} -eq ${LOOPS_BIG} ]; then
9350 check 1-${LOOPS_BIG} - "${MBOX}" '3835365533 51534'
9351 elif [ ${LOOPS_MAX} -eq ${LOOPS_SMALL} ]; then
9352 check 1-${LOOPS_SMALL} - "${MBOX}" '3647549277 4686'
9356 printf 'm this-goes@nowhere\nbody\n!.\n' |
9357 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
9358 -St_remove=1 -X'source ./.trc' -Smta=test://"$MBOX" \
9359 -Smaximum=${LOOPS_MAX} \
9362 ${cat} ./.tall >> "${MBOX}"
9363 if [ ${LOOPS_MAX} -eq ${LOOPS_BIG} ]; then
9364 check 2-${LOOPS_BIG} - "${MBOX}" '3768249992 34402'
9365 elif [ $LOOPS_MAX -eq ${LOOPS_SMALL} ]; then
9366 check 2-${LOOPS_SMALL} - "${MBOX}" '4042568441 3170'
9372 t_lreply_futh_rth_etc() {
9375 ${cat} <<-_EOT > ./.tmbox
9376 From neverneverland Sun Jul 23 13:46:25 2017
9377 Subject: Bugstop: five miles out 1
9378 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
9379 From: mister originator <mr@originator>
9380 To: bugstop-commit@five.miles.out, laber@backe.eu
9382 Mail-Followup-To: bugstop@five.miles.out, laber@backe.eu, is@a.list
9383 In-reply-to: <20170719111113.bkcMz%laber@backe.eu>
9384 Date: Wed, 19 Jul 2017 09:22:57 -0400
9385 Message-Id: <20170719132257.766AF781267@originator>
9388 > |Sorry, I think I misunderstand something. I would think that
9392 From neverneverland Fri Jul 7 22:39:11 2017
9393 Subject: Bugstop: five miles out 2
9394 Reply-To: mister originator2<mr2@originator>,bugstop@five.miles.out,is@a.list
9395 Content-Transfer-Encoding: 7bit
9396 From: mister originator <mr@originator>
9397 To: bugstop-commit@five.miles.out
9399 Message-ID: <149945963975.28888.6950788126957753723.reportbug@five.miles.out>
9400 Date: Fri, 07 Jul 2017 16:33:59 -0400
9403 capable of changing back.
9405 From neverneverland Fri Jul 7 22:42:00 2017
9406 Subject: Bugstop: five miles out 3
9407 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
9408 Content-Transfer-Encoding: 7bit
9409 From: mister originator <mr@originator>
9410 To: bugstop-commit@five.miles.out
9412 Message-ID: <149945963975.28888.6950788126957753746.reportbug@five.miles.out>
9413 Date: Fri, 07 Jul 2017 16:33:59 -0400
9414 List-Post: <mailto:bugstop@five.miles.out>
9417 are you ready, boots?
9419 From neverneverland Sat Aug 19 23:15:00 2017
9420 Subject: Bugstop: five miles out 4
9421 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
9422 Content-Transfer-Encoding: 7bit
9423 From: mister originator <mr@originator>
9424 To: bugstop@five.miles.out
9426 Message-ID: <149945963975.28888.6950788126qtewrqwer.reportbug@five.miles.out>
9427 Date: Fri, 07 Jul 2017 16:33:59 -0400
9428 List-Post: <mailto:bugstop@five.miles.out>
9431 are you ready, boots?
9436 ${cat} <<-'_EOT' | ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" \
9437 -Rf ./.tmbox >> "${MBOX}" 2>&1
9439 wysh set m="This is text of \"reply ${1}."
9450 echo -----After reply $1.1 - $1.3: $?/$^ERRNAME
9453 wysh set m="This is text of \"Reply ${1}."
9459 echo -----After Reply $1.$2: $?/$^ERRNAME
9468 wysh set m="This is text of \"Lreply ${1}." on-compose-splice=_Lh n=$2
9472 # We need two indirections for this test: one for the case that Lreply
9473 # fails because of missing recipients: we need to read EOF next, thus
9474 # place this in _Ls last; and second for the succeeding cases EOF is
9475 # not what these should read, so go over the backside and splice it in!
9476 # (A shame we do not have redirection++ as a Bourne/K/POSIX shell!)
9478 echo -----After Lreply $1.$2: $?/$^ERRNAME
9481 localopts call-fixate yes
9483 call R $1 1; call R $1 2; call R $1 3; call R $1 4
9484 call L $1 1; call L $1 2; call L $1 3
9487 echo;echo '===== CHANGING === '"$*"' =====';echo
9491 set from=laber@backe.eu
9494 call tweak set reply-to-honour
9496 call tweak set followup-to
9498 call tweak set followup-to-honour
9500 call tweak mlist bugstop@five.miles.out
9502 call tweak mlsubscribe bugstop@five.miles.out
9504 call tweak set recipients-in-cc
9506 # While here, test that *fullnames* works (also here)
9507 call tweak set fullnames
9509 This message should have *fullnames* in the header.
9512 call tweak unmlsubscribe bugstop@five.miles.out';' \
9513 set followup-to-add-cc nofullnames
9515 call tweak mlsubscribe bugstop@five.miles.out
9520 if have_feat uistrings; then
9521 check 1 - "${MBOX}" '1519985418 39828'
9523 t_echoskip '1:[!UISTRINGS]'
9528 ${cat} <<-_EOT > ./.tmbox
9529 From tom@i-i.example Thu Oct 26 03:15:55 2017
9530 Date: Wed, 25 Oct 2017 21:15:46 -0400
9531 From: tom <tom@i-i.example>
9532 To: Steffen Nurpmeso <steffen@sdaoden.eu>
9533 Cc: tom <tom@i-i.example>
9534 Subject: Re: xxxx yyyyyyyy configure does not really like a missing zzzzz
9535 Message-ID: <20171026011546.GA11643@i-i.example>
9536 Reply-To: tom@i-i.example
9537 References: <20171025214601.T2pNd%steffen@sdaoden.eu>
9538 In-Reply-To: <20171025214601.T2pNd%steffen@sdaoden.eu>
9541 The report's useful :-)
9544 # Let us test In-Reply-To: removal starts a new thread..
9545 # This needs adjustment of *stealthmua*
9546 argadd='-Sstealthmua=noagent -Shostname'
9549 printf 'reply 1\nthread\n!.\n' |
9550 ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" -Sreply-to-honour \
9551 ${argadd} -Rf ./.tmbox > .tall 2>&1
9552 check 2 0 "${MBOX}" '841868335 433'
9553 check 3 - .tall '4294967295 0'
9555 printf 'reply 1\nnew <- thread!\n!||%s -e "%s"\n!.\n' \
9556 "${sed}" '/^In-Reply-To:/d' |
9557 ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" -Sreply-to-honour \
9558 ${argadd} -Rf "${MBOX}" > .tall 2>&1
9559 check 4 0 "${MBOX}" '3136957908 771'
9560 check 5 - .tall '4294967295 0'
9562 printf 'reply 2\nold <- new <- thread!\n!.\n' |
9563 ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" -Sreply-to-honour \
9564 ${argadd} -Rf "${MBOX}" > .tall 2>&1
9565 check 6 0 "${MBOX}" '3036449053 1231'
9566 check 7 - .tall '4294967295 0'
9568 printf 'reply 3\nnew <- old <- new <- thread!\n!|| %s -e "%s"\n!.\n' \
9569 "${sed}" '/^In-Reply-To:/d' |
9570 ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" -Sreply-to-honour \
9571 ${argadd} -Rf "${MBOX}" > .tall 2>&1
9572 check 8 0 "${MBOX}" '2069841383 1583'
9573 check 9 - .tall '4294967295 0'
9575 # And follow-up testing whether changing In-Reply-To: to - starts a new
9576 # thread with only the message being replied-to.
9578 printf 'reply 1\nthread with only one ref!\n!||%s -e "%s"\n!.\n' \
9579 "${sed}" 's/^In-Reply-To:.*$/In-Reply-To:-/' |
9580 ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" -Sreply-to-honour \
9581 ${argadd} -Rf "${MBOX}" > .tall 2>&1
9582 check 10 0 "${MBOX}" '3155846378 2047'
9583 check 11 - .tall '4294967295 0'
9591 if have_feat cmd-vexpr; then :; else
9592 t_echoskip '[!CMD_VEXPR]'
9597 # "Test for" [d6f316a] (Gavin Troy)
9598 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
9599 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="?* ${cat}" > "${BODY}"
9600 check 1 0 "${MBOX}" '3942990636 118'
9601 check 2 - "${BODY}" '3951695530 170'
9604 printf "m %s\n~s subject2\n~@%s\nBody2\n~.\nFi %s\nmimeview\nx\n" \
9605 "${MBOX}" "${TOPDIR}snailmail.jpg" "${MBOX}" |
9606 ${MAILX} ${ARGS} ${ADDARG_UNI} \
9607 -S 'pipe-text/plain=?' \
9608 -S 'pipe-image/jpeg=?=&?'\
9609 'trap \"'"${rm}"' -f '\ '\\"${MAILX_FILENAME_TEMPORARY}\\"\" EXIT;'\
9610 'trap \"trap \\\"\\\" INT QUIT TERM; exit 1\" INT QUIT TERM;'\
9611 '{ echo C=$MAILX_CONTENT;'\
9612 'echo C-E=$MAILX_CONTENT_EVIDENCE;'\
9613 'echo E-B-U=$MAILX_EXTERNAL_BODY_URL;'\
9614 'echo F=$MAILX_FILENAME;'\
9615 'echo F-G=not testable MAILX_FILENAME_GENERATED;'\
9616 'echo F-T=not testable MAILX_FILENAME_TEMPORARY;'\
9617 ''"${cksum}"' < \"${MAILX_FILENAME_TEMPORARY}\" |'\
9618 ''"${sed}"' -e "s/[ ]\{1,\}/ /g"; } > ./.tax 2>&1;'"${mv}"' ./.tax ./.tay' \
9620 check 3 0 "${MBOX}" '1933681911 13435'
9621 check 4 - "${BODY}" '2036666633 493'
9622 check 4-hdl - ./.tay '144517347 151' async
9625 if [ -z "${ln}" ]; then
9626 t_echoskip '5:[ln(1) not found]'
9628 # Let us fill in tmpfile, test auto-deletion
9629 printf 'Fi %s\nmimeview\nvput vexpr v file-stat .t.one-link\n'\
9630 'eval wysh set $v;echo should be $st_nlink link\nx\n' "${MBOX}" |
9631 ${MAILX} ${ARGS} ${ADDARG_UNI} \
9632 -S 'pipe-text/plain=?' \
9633 -S 'pipe-image/jpeg=?=++?'\
9634 'echo C=$MAILX_CONTENT;'\
9635 'echo C-E=$MAILX_CONTENT_EVIDENCE;'\
9636 'echo E-B-U=$MAILX_EXTERNAL_BODY_URL;'\
9637 'echo F=$MAILX_FILENAME;'\
9638 'echo F-G=not testable MAILX_FILENAME_GENERATED;'\
9639 'echo F-T=not testable MAILX_FILENAME_TEMPORARY;'\
9640 "${ln}"' -f $MAILX_FILENAME_TEMPORARY .t.one-link;'\
9641 ''"${cksum}"' < \"${MAILX_FILENAME_TEMPORARY}\" |'\
9642 ''"${sed}"' -e "s/[ ]\{1,\}/ /g"' \
9644 check 5 0 "${BODY}" '4260004050 661'
9646 # Fill in ourselfs, test auto-deletion
9647 printf 'Fi %s\nmimeview\nvput vexpr v file-stat .t.one-link\n'\
9648 'eval wysh set $v;echo should be $st_nlink link\nx\n' "${MBOX}" |
9649 ${MAILX} ${ARGS} ${ADDARG_UNI} \
9650 -S 'pipe-text/plain=?' \
9651 -S 'pipe-image/jpeg=?++?'\
9652 "${cat}"' > $MAILX_FILENAME_TEMPORARY;'\
9653 'echo C=$MAILX_CONTENT;'\
9654 'echo C-E=$MAILX_CONTENT_EVIDENCE;'\
9655 'echo E-B-U=$MAILX_EXTERNAL_BODY_URL;'\
9656 'echo F=$MAILX_FILENAME;'\
9657 'echo F-G=not testable MAILX_FILENAME_GENERATED;'\
9658 'echo F-T=not testable MAILX_FILENAME_TEMPORARY;'\
9659 ''"${cksum}"' < \"${MAILX_FILENAME_TEMPORARY}\" |'\
9660 ''"${sed}"' -e "s/[ ]\{1,\}/ /g"' \
9662 check 6 0 "${BODY}" '4260004050 661'
9664 # And the same, via copiousoutput (fake)
9665 printf 'Fi %s\np\nvput vexpr v file-stat .t.one-link\n'\
9666 'eval wysh set $v;echo should be $st_nlink link\nx\n' "${MBOX}" |
9667 ${MAILX} ${ARGS} ${ADDARG_UNI} \
9668 -S 'pipe-text/plain=?' \
9669 -S 'pipe-image/jpeg=?*++?'\
9670 "${cat}"' > $MAILX_FILENAME_TEMPORARY;'\
9671 'echo C=$MAILX_CONTENT;'\
9672 'echo C-E=$MAILX_CONTENT_EVIDENCE;'\
9673 'echo E-B-U=$MAILX_EXTERNAL_BODY_URL;'\
9674 'echo F=$MAILX_FILENAME;'\
9675 'echo F-G=not testable MAILX_FILENAME_GENERATED;'\
9676 'echo F-T=not testable MAILX_FILENAME_TEMPORARY;'\
9677 "${ln}"' -f $MAILX_FILENAME_TEMPORARY .t.one-link;'\
9678 ''"${cksum}"' < \"${MAILX_FILENAME_TEMPORARY}\" |'\
9679 ''"${sed}"' -e "s/[ ]\{1,\}/ /g"' \
9681 check 7 0 "${BODY}" '709946464 677'
9690 if have_feat mailcap; then :; else
9691 t_echoskip '[!MAILCAP]'
9696 ${cat} <<-'_EOT' > ./.tmailcap
9697 text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html
9698 application/pdf; /Applications/Preview.app/Contents/MacOS/Preview %s;\
9699 nametemplate=%s.pdf;\
9700 test = [ "${OSTYPE}" = darwin ]
9703 trap "rm -f ${infile}" EXIT\;\
9704 trap "exit 75" INT QUIT TERM\;\
9706 test = [ -n "${DISPLAY}" ];\
9707 nametemplate = %s.pdf; x-mailx-async
9708 application/pdf; pdftotext -layout %s -; nametemplate=%s.pdf; copiousoutput
9709 application/*; echo "This is \\"%t\\" but \
9710 is 50 \% Greek to me" \; < %s head -c 1024 | cat -vet; \
9711 description=" this is\;a \"wildcard\" match, no trailing quote! ;\
9712 copiousoutput; x-mailx-noquote
9717 application/postscript; ps-to-terminal %s;\ needsterminal
9718 application/postscript; ps-to-terminal %s; \compose=idraw %s
9719 x-be2; the-cmd %s; \
9720 print=print-cmd %s ; \
9722 compose=compose-cmd -d %s ; \
9724 composetyped = composetyped-cmd -dd %s ; \
9726 edit=edit-cmd -ddd %s; \
9727 description = a\;desc;\
9728 nametemplate=%s.be2;\
9729 test = this is "a" test ; \
9730 x-mailx-test-once ;\
9731 x11-bitmap = x11-bitmap.bpm;;;;;
9732 application/*; echo "is \"%t\" \
9733 50 \% Greek" \; cat %s; copiousoutput; \; description="catch-all buddy";
9734 audio/*; showaudio;compose=%n
9735 image/jpeg; showpicture -viewer xv %s
9736 image/*; showpicture %s
9737 message/partial; showpartial %s %{id} %{number} %{total}
9738 application/postscript ; lpr %s ; label="PS File";\
9739 compose="getx PS %s"
9740 application/atomicmail; atomicmail %s ; needsterminal
9741 application/andrew-inset; ezview %s ; copiousoutput;\
9742 edit=ez -d %s; compose="ez -d %s"; label="Andrew i/d"
9743 text/richtext; xy iso-8859-1 -e richtext -p %s; \
9744 test=test "`echo %{charset
} |
tr A-Z a-z
`" = iso-8859-1; copiousoutput
9745 text/plain; xy iso-8859-1 %s;\
9746 test=test "`echo %{charset
} |
tr A-Z a-z
`" = iso-8859-1; copiousoutput
9747 text/richtext; rich %s %{not-closed; copiousoutput
9748 default; cat %s; copiousoutput
9750 ${chmod} 0644 ./.tmailcap
9752 printf 'm;echo =1/$?;m c;echo =2/$?;
9753 mailca loa;echo =3/$?;mailc s;echo =4/$?' |
9754 MAILCAPS=./.tmailcap ${MAILX} -X'commandalias m mailcap' ${ARGS} \
9756 check 1 0 ./.tall '2012114724 3064'
9757 have_feat uistrings && i='3903313993 2338' || i='4294967295 0'
9758 check 2 - ./.terr "${i}"
9762 echo 'From me with love' | ${MAILX} ${ARGS} -s sub1 "${MBOX}"
9763 check 3 0 "${MBOX}" '4224630386 228'
9765 # For reproducability, one pseudo check with cat(1) and mv(1)
9767 text/plain; echo p-1-1\\;< %%s cat\\;echo p-1-2;\\
9768 test=echo X >> ./.terrmc\\; [ -n "$XY" ];x-mailx-test-once
9769 text/plain; echo p-2-1\\;< %%s cat\\;echo p-2-2;\\
9770 test=echo Y >> ./.terrmc\\;[ -z "$XY" ]
9771 text/plain; { file=%%s\\; echo p-3-1 = ${file##*.}\\;\\
9772 </dev/null cat %%s\\;echo p-3-2\\; } > ./.tx\\; mv -f ./.tx ./.tasy;\\
9773 test=[ -n "$XY" ];nametemplate=%%s.txt;x-mailx-async
9774 text/plain; echo p-4-1\\;cat\\;echo p-4-2;copiousoutput
9777 </dev/null MAILCAPS=./.tmailcap TMPDIR=`${pwd}` \
9778 ${MAILX} ${ARGS} -Snomailcap-disable \
9780 -Rf "${MBOX}" > ./.tall 2>./.terr
9781 check 4.pre 0 ./.tall '1428075831 455'
9783 # Same with real programs
9785 text/plain; echo p-1-1\\;< %%s %s\\;echo p-1-2;\\
9786 test=echo X >> ./.terrmc\\; [ -n "$XY" ];x-mailx-test-once
9787 text/plain; echo p-2-1\\;< %%s %s\\;echo p-2-2;\\
9788 test=echo Y >> ./.terrmc\\;[ -z "$XY" ]
9789 text/plain; { file=%%s\\; echo p-3-1 = ${file##*.}\\;\\
9790 </dev/null %s %%s\\;echo p-3-2\\; } > ./.tx\\; %s -f ./.tx ./.tasy;\\
9791 test=[ -n "$XY" ];nametemplate=%%s.txt;x-mailx-async
9792 text/plain; echo p-4-1\\;%s\\;echo p-4-2;copiousoutput
9793 ' "${cat}" "${cat}" "${cat}" "${mv}" "${cat}" > ./.tmailcap
9795 </dev/null MAILCAPS=./.tmailcap TMPDIR=`${pwd}` \
9796 ${MAILX} ${ARGS} -Snomailcap-disable \
9807 -Rf "${MBOX}" > ./.tall 2>./.terr
9808 check 4 0 ./.tall '1912261831 831'
9809 check 5 - ./.terr '4294967295 0'
9810 check 6 - ./.terrmc '2376112102 6'
9811 check 7 - ./.tasy '3913344578 37' async
9813 # "Binary data"; ensure all possible temporary file / nametemplate
9814 # etc. paths are taken: avoid 2nd e7a60732c1906aefe4755fd61c5ffa81eeca0af0
9817 printf 'du\x7fbo€o\bm' > ./.tatt.pdf
9818 printf 'du' | ${MAILX} ${ARGS} -a ./.tatt.pdf -s test "${MBOX}"
9819 check 8 0 "${MBOX}" '3444709420 644'
9823 application/pdf; echo p-1-1\\;%s\\;echo p-1-2; test=[ "$XY" = "" ]
9824 # tmpfile, no template
9825 application/pdf; echo p-2-1\\;< %%s %s\\;echo p-2-2; test = [ "$XY" = two ]
9827 application/pdf; echo p-3-1\\;< %%s %s\\;echo p-3-2; test=[ "$XY" = three ];\\
9828 nametemplate=%%s.txt
9829 # tmpfile, template, async
9830 application/pdf; { file=%%s \\; echo p-4-1 = ${file##*.}\\;\\
9831 </dev/null %s %%s\\;echo p-4-2\\; } > ./.tx\\; %s -f ./.tx ./.tasy;\\
9832 test=[ "$XY" = four ] ; nametemplate = %%s.txt ; x-mailx-async
9834 application/pdf; echo p-5-1\\;%s\\;echo p-5-2; test=[ "$XY" = 1 ];\\
9836 # copious, tmpfile, no template
9837 application/pdf; echo p-6-1\\;< %%s %s\\;echo p-6-2; test = [ "$XY" = 2 ];\\
9839 # copious, tmpfile, template
9840 application/pdf; echo p-7-1\\;< %%s %s\\;echo p-7-2;test = [ "$XY" = 3 ];\\
9841 nametemplate=%%s.txt; copiousoutput
9842 ' "${cat}" "${cat}" "${cat}" "${cat}" "${mv}" "${cat}" "${cat}" "${cat}" \
9845 </dev/null XY= MAILCAPS=./.tmailcap TMPDIR=`${pwd}` \
9846 ${MAILX} ${ARGS} -Snomailcap-disable \
9854 \environ set XY=three
9857 \environ set XY=four
9870 -Rf "${MBOX}" > ./.tall 2>./.terr
9871 check 9 0 ./.tall '2388630345 3850'
9872 check 10 - ./.terr '4294967295 0'
9873 check 11 - ./.tasy '842146666 27' async
9875 # x-mailx-last-resort, x-mailx-ignore
9878 printf 'in a pdf\n' > ./.tatt.pdf
9879 printf 'du\n' | ${MAILX} ${ARGS} -a ./.tatt.pdf -s test "${MBOX}"
9880 check 12 0 "${MBOX}" '3968874750 579'
9884 application/pdf;echo hidden;x-mailx-ignore
9885 application/pdf;echo hidden;copiousoutput;x-mailx-ignore
9886 application/pdf; echo pre\\;%s\\;echo post; x-mailx-last-resort
9887 ' "${cat}" > ./.tmailcap
9889 </dev/null XY= MAILCAPS=./.tmailcap TMPDIR=`${pwd}` \
9890 ${MAILX} ${ARGS} -Snomailcap-disable \
9895 \mimetype ?t application/pdf pdf
9900 \unmimetype application/pdf
9904 -Rf "${MBOX}" > ./.tall 2>./.terr
9905 check 13 0 ./.tall '759843612 1961'
9906 check 14 - ./.terr '4294967295 0'
9912 # Unclassified rest {{{
9916 t__gen_msg subject top1 to 1 from 1 cc 1 body 'body1-1
9925 t__gen_msg subject top2 to 1 from 1 cc 1 body 'body2-1
9936 ${MAILX} ${ARGS} -Rf -Y '#
9938 \echo --- $?/$^ERRNAME, 1; \set toplines=10
9940 \echo --- $?/$^ERRNAME, 2; \set toplines=5
9941 \headerpick top retain subject # For top
9942 \headerpick type retain to subject # For Top
9944 \echo --- $?/$^ERRNAME, 3; \set topsqueeze
9946 \echo --- $?/$^ERRNAME, 4
9948 \echo --- $?/$^ERRNAME, 5
9949 # ' "${MBOX}" > ./.tall 2>&1
9950 check 1 0 ./.tall '2556125754 705'
9958 if have_feat smime; then :; else
9959 t_echoskip '[!SMIME]'
9964 ${cat} <<-_EOT > ./.t.conf
9966 x509_extensions = extensions
9967 distinguished_name = req_distinguished_name
9968 attributes = req_attributes
9970 output_password = Pacem_in_terris
9973 basicConstraints = CA:FALSE
9974 # Needs a CA for that keyUsage = digitalSignature
9975 extendedKeyUsage = emailProtection
9977 [req_distinguished_name]
9984 emailAddress = test@localhost
9987 challengePassword = hi ca it is me me me
9993 if [ "${_z}" = 0 ]; then
9998 _pass=Pacem_in_terris
10000 _ossl='-passin pass:'${_pass}
10003 ${rm} -f ./.VERIFY ./.ENCRYPT ./.DECRYPT
10005 openssl req ${_osslreq} ${_ossl} -x509 -days 3650 -config ./.t.conf \
10006 -newkey rsa:1024 -keyout ./.tkey.pem -out ./.tcert.pem >>${ERR} 2>&1
10010 ${cat} ./.tkey.pem ./.tcert.pem > ./.tpair.pem
10013 echo bla | ${MAILX} ${ARGS} \
10014 -Ssmime-sign -Ssmime-sign-cert=./.tpair.pem -Sfrom=test@localhost \
10015 -Ssmime-sign-digest=sha1 \
10016 -S password-test@localhost.smime-cert-key=${_pass} \
10017 -s 'S/MIME test' ./.VERIFY >>${ERR} 2>&1
10018 check_ex0 ${_z}-estat
10021 /^Content-Description: /{ skip = 2; print; next }
10022 /^$/{ if(skip) --skip }
10023 { if(!skip) print }
10025 < ./.VERIFY > "${MBOX}"
10026 check ${_z} - "${MBOX}" '335634014 644'
10029 printf 'verify\nx\n' |
10030 ${MAILX} ${ARGS} -Ssmime-ca-file=./.tcert.pem -Serrexit \
10031 -R -f ./.VERIFY >>${ERR} 2>&1
10032 check_ex0 ${_z} # XXX pipe
10035 openssl smime -verify -CAfile ./.tcert.pem -in ./.VERIFY >>${ERR} 2>&1
10039 # (signing +) encryption / decryption
10042 -Smta=test://./.ENCRYPT \
10043 -Ssmime-force-encryption -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
10044 -Ssmime-sign-digest=sha1 \
10045 -Ssmime-sign -Ssmime-sign-cert=./.tpair.pem -Sfrom=test@localhost \
10046 -S password-test@localhost.smime-cert-key=${_pass} \
10047 -s 'S/MIME test' recei@ver.com >>${ERR} 2>&1
10048 check_ex0 ${_z}-estat
10049 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
10050 check ${_z} - "${MBOX}" '2359655411 336'
10053 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
10055 -Smta=test://./.ENCRYPT \
10056 -Ssmime-ca-file=./.tcert.pem \
10057 -Ssmime-sign-cert=./.tpair.pem \
10058 -Sfrom=test@localhost \
10059 -S password-test@localhost.smime-cert-key=${_pass} \
10060 -Serrexit -R -f ./.ENCRYPT >>${ERR} 2>&1
10061 check_ex0 ${_z}-estat
10064 /^Content-Description: /{ skip = 2; print; next }
10065 /^$/{ if(skip) --skip }
10066 { if(!skip) print }
10068 < ./.DECRYPT > "${MBOX}"
10069 check ${_z} - "${MBOX}" '2602978204 940'
10072 (openssl smime -decrypt ${_ossl} -inkey ./.tkey.pem -in ./.ENCRYPT |
10073 openssl smime -verify -CAfile ./.tcert.pem) >>${ERR} 2>&1
10074 check_ex0 ${_z} # XXX pipe..
10078 echo bla | ${MAILX} ${ARGS} \
10079 -Smta=test://./.ENCRYPT \
10080 -Ssmime-force-encryption -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
10081 -Sfrom=test@localhost \
10082 -S password-test@localhost.smime-cert-key=${_pass} \
10083 -s 'S/MIME test' recei@ver.com >>${ERR} 2>&1
10084 check_ex0 ${_z}-estat
10085 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
10086 check ${_z} - "${MBOX}" '2359655411 336'
10090 # Note: deduce from *sign-cert*, not from *from*!
10091 printf 'decrypt ./.DECRYPT\nx\n' | ${MAILX} ${ARGS} \
10092 -Smta=test://./.ENCRYPT \
10093 -Ssmime-sign-cert-recei@ver.com=./.tpair.pem \
10094 -S password-recei@ver.com.smime-cert-key=${_pass} \
10095 -Serrexit -R -f ./.ENCRYPT >>${ERR} 2>&1
10096 check ${_z} 0 ./.DECRYPT '2453471323 431'
10099 openssl smime ${_ossl} -decrypt -inkey ./.tkey.pem -in ./.ENCRYPT \
10103 unset _z _pass _osslreq _ossl
10113 # xxx Note: t_z() was the first test (series) written. Today many
10114 # xxx aspects are (better) covered by other tests above, some are not.
10115 # xxx At some future date and time, convert the last remains not covered
10116 # xxx elsewhere to a real t_* test and drop it
10120 # Test for [260e19d] (Juergen Daubert)
10121 echo body | ${MAILX} ${ARGS} "${MBOX}"
10122 check 4 0 "${MBOX}" '2948857341 94'
10124 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
10127 for(i = 0; i < 10000; ++i)
10129 #printf "\xF0\x90\x87\x90"
10130 }' | ${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
10131 check 7 0 "${MBOX}" '1707496413 61812'
10138 t___gen_msg '' "${@}"
10142 t___gen_msg 1 "${@}"
10154 while [ ${___hi} -le ${3} ]; do
10155 [ ${___hi} -gt 1 ] && printf ', '
10156 printf '%s%s <%s%s@exam.ple>' ${1} ${___hi} ${2} ${___hi}
10157 ___hi=`add
${___hi} 1`
10167 printf 'From reproducible_build Wed Oct 2 01:50:07 1996
10168 Date: Wed, 02 Oct 1996 01:50:07 +0000
10172 while [ ${#} -ge 2 ]; do
10174 from) t___header From from "${2}";;
10175 to) t___header To to "${2}";;
10176 cc) t___header Cc cc "${2}";;
10177 bcc) t___header Bcc bcc "${2}";;
10178 subject) printf 'Subject: %s\n' "${2}";;
10179 body) body="${2}";;
10184 if [ -z "${ismime}" ]; then
10185 printf '\n%s\n\n' "${body}"
10187 printf 'MIME-Version: 1.0
10188 Message-ID: <20200204225307.FaKeD%%bo@oo>
10189 Content-Type: multipart/mixed; boundary="=BOUNDOUT="
10192 Content-Type: multipart/alternative; boundary==BOUNDIN=
10195 Content-Type: text/plain; charset=utf-8
10196 Content-Transfer-Encoding: 8-bit
10201 Content-Type: text/html; charset=utf-8
10202 Content-Transfer-Encoding: 8-bit
10204 <HTML><BODY>%s<BR></BODY></HTML>
10209 Content-Type: text/troff
10214 Content-Type: text/x-uuencode
10216 Aprendimos a quererte
10219 ' "${body}" "${body}"
10225 From neverneverland Sun Jul 23 13:46:25 2017
10226 Subject: Bugstop: five miles out 1
10227 Reply-To: mister originator1 <mr1@originator>
10228 From: mister originator1 <mr1@originator>
10229 To: bugstop-commit@five.miles.out
10231 In-reply-to: <20170719111113.bkcMz%laber1@backe.eu>
10232 Date: Wed, 19 Jul 2017 09:22:57 -0400
10233 Message-Id: <20170719132257.766AF781267-1@originator>
10234 Mail-Followup-To: bugstop@five.miles.out, laber@backe.eu, is@a.list
10237 That's appalling, I.
10244 From neverneverland Sun Jul 23 13:47:25 2017
10245 Subject: Bugstop: five miles out 2
10246 Reply-To: mister originator2 <mr2@originator>
10247 From: mister originator2 <mr2@originator>
10248 To: bugstop-commit@five.miles.out
10250 In-reply-to: <20170719111113.bkcMz%laber2@backe.eu>
10251 Date: Wed, 19 Jul 2017 09:23:57 -0400
10252 Message-Id: <20170719132257.766AF781267-2@originator>
10255 That's appalling, II.
10262 From neverneverland Sun Jul 23 13:48:25 2017
10263 Subject: Bugstop: five miles out 3
10264 Reply-To: mister originator3 <mr3@originator>
10265 From: mister originator3 <mr3@originator>
10266 To: bugstop-commit@five.miles.out
10268 In-reply-to: <20170719111113.bkcMz%laber3@backe.eu>
10269 Date: Wed, 19 Jul 2017 09:24:57 -0400
10270 Message-Id: <20170719132257.766AF781267-3@originator>
10273 That's appalling, III.
10279 # MIME encoding (QP) stress message subject
10280 printf 'Äbrä Kä?dä=brö Fü?di=bus? '\
10281 'adadaddsssssssddddddddddddddddddddd'\
10282 'ddddddddddddddddddddddddddddddddddd'\
10283 'ddddddddddddddddddddddddddddddddddd'\
10284 'dddddddddddddddddddd Hallelulja? Od'\
10285 'er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
10286 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
10287 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f'\
10288 'fffffffffffffffffffffffffffffffffff'\
10289 'fffffffffffffffffffff ggggggggggggg'\
10290 'ggggggggggggggggggggggggggggggggggg'\
10291 'ggggggggggggggggggggggggggggggggggg'\
10292 'ggggggggggggggggggggggggggggggggggg'\
10297 # MIME encoding (QP) stress message body
10299 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
10300 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
10301 "wasde willst, gelle, gelle, gelle, gelle, gelle.\r\n"\
10302 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst \r\n"\
10303 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1\r\n"\
10304 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12\r\n"\
10305 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123\r\n"\
10306 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234\r\n"\
10307 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345\r\n"\
10308 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456\r\n"\
10309 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234567\r\n"\
10310 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345678\r\n"\
10311 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456789\r\n"\
10312 "Unn ausserdem habe ich trailing SP/HT/SP/HT whitespace \r\n"\
10313 "Unn ausserdem habe ich trailing HT/SP/HT/SP whitespace \r\n"\
10314 "auf den zeilen vorher.\r\n"\
10315 "From am Zeilenbeginn und From der Mitte gibt es auch.\r\n"\
10317 "Die letzte Zeile war nur ein Punkt.\r\n"\
10319 "Das waren deren zwei.\r\n"\
10321 "Die letzte Zeile war ein Leerschritt.\n"\
10322 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
10323 "Prösterchen.\r\n"\
10325 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
10327 "Das waren deren zwei. ditto.\n"\
10329 "Unn ausseerdem habe ich trailing SP/HT/SP/HT whitespace \n"\
10330 "Unn ausseerdem habe ich trailing HT/SP/HT/SP whitespace \n"\
10331 "auf den zeilen vorher.\n"\
10333 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.\n"\
10334 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.1"\
10336 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
10338 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
10340 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
10342 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
10344 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
10346 "QP am Zeilenende über soft-nl hinweg\n"\
10347 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
10349 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
10351 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
10353 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
10355 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
10357 "Die letzte Zeile war ein Leerschritt.\n"\
10362 # cc_all_configs() {{{
10363 # Test all configs TODO doesn't cover all *combinations*, stupid!
10365 if [ ${MAXJOBS} -gt 1 ]; then
10366 MAXJOBS='-j '${MAXJOBS}
10370 if [ -n "${NOCOLOUR}" ] || [ -n "${MAILX_CC_TEST_NO_COLOUR}" ]; then
10371 MAILX_CC_TEST_NO_COLOUR=1
10372 export MAILX_CC_TEST_NO_COLOUR
10377 ALWAYS = "OPT_AUTOCC=1 OPT_AMALGAMATION=1"
10378 NOTME["OPT_AUTOCC_STACKPROT"] = 1
10379 NOTME["OPT_ALWAYS_UNICODE_LOCALE"] = 1
10380 NOTME["OPT_CROSS_BUILD"] = 1
10381 NOTME["OPT_AUTOCC"] = 1
10382 NOTME["OPT_AMALGAMATION"] = 1
10383 NOTME["OPT_DEBUG"] = 1
10384 NOTME["OPT_DEVEL"] = 1
10385 NOTME["OPT_ASAN_ADDRESS"] = 1
10386 NOTME["OPT_ASAN_MEMORY"] = 1
10387 NOTME["OPT_NOMEMDBG"] = 1
10392 MULCHOICE["OPT_IDNA"] = "VAL_IDNA"
10393 MULVALS["VAL_IDNA"] = 1
10395 #VALKEYS[0] = "VAL_RANDOM"
10396 VALVALS["VAL_RANDOM"] = 1
10401 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
10402 # does not seem to be a compliant escape for =
10404 $1 = substr($1, 1, index($1, "=") - 1)
10406 OPTVALS[OPTNO++] = $1
10411 val = substr($0, index($0, "=") + 1)
10413 val = substr(val, 2)
10414 val = substr(val, 1, length(val) - 1)
10416 $1 = substr($1, 1, index($1, "=") - 1)
10419 else if(VALVALS[$1]){
10420 VALKEYS[VALNO++] = $1
10425 function onepass(addons){
10426 a_onepass__worker(addons, "1", "0")
10427 a_onepass__worker(addons, "0", "1")
10429 function a_onepass__worker(addons, b0, b1){
10430 # Doing this completely sequentially and not doing make distclean in
10431 # between runs should effectively result in lesser compilations.
10432 # It is completely dumb nonetheless... TODO
10433 for(ono = 0; ono < OPTNO; ++ono){
10435 for(i = 0; i < ono; ++i){
10436 myconf = myconf " " OPTVALS[i] "=" b0 " "
10438 j = MULCHOICE[OPTVALS[i]]
10443 myconf = myconf " " MULCHOICE[OPTVALS[i]] "=any "
10447 for(i = ono; i < OPTNO; ++i){
10448 myconf = myconf " " OPTVALS[i] "=" b1 " "
10450 j = MULCHOICE[OPTVALS[i]]
10455 myconf = myconf " " MULCHOICE[OPTVALS[i]] "=any "
10461 myconf = VALKEYS[i] "=any " myconf
10463 myconf = myconf " " ALWAYS " " addons
10468 i = split(MULVALS[mula], ia)
10472 print mula "=\"" j "\" " myconf
10478 # We cannot test NULL because of missing UI strings, which will end
10479 # up with different checksums
10480 print "CONFIG=NULLI OPT_AUTOCC=1"
10482 j = split(VALVALS[VALKEYS[i]], ia)
10486 print VALKEYS[i] "=\"" k "\" CONFIG=NULLI OPT_AUTOCC=1"
10489 print "CONFIG=MINIMAL OPT_AUTOCC=1"
10490 print "CONFIG=NETSEND OPT_AUTOCC=1"
10491 print "CONFIG=MAXIMAL OPT_AUTOCC=1"
10493 j = split(VALVALS[VALKEYS[i]], ia)
10497 print VALKEYS[i] "=\"" k "\" CONFIG=MAXIMAL OPT_AUTOCC=1"
10500 print "CONFIG=DEVEL OPT_AUTOCC=1"
10501 print "CONFIG=ODEVEL OPT_AUTOCC=1"
10505 onepass("OPT_DEBUG=1")
10508 ' | while read c; do
10509 if [ "$c" = split_here ]; then
10510 printf 'Predefined configs done, now OPT_ combinations\n'
10511 printf 'Predefined configs done, now OPT_ combinations\n' >&2
10512 ${SHELL} -c "cd ../ && ${MAKE} distclean"
10515 [ -f mk-config.h ] && ${cp} mk-config.h .ccac.h
10516 printf "\n\n##########\n${MAKE} ${MAXJOBS} config $c\n"
10517 printf "\n\n##########\n${MAKE} ${MAXJOBS} config $c\n" >&2
10518 ${SHELL} -c "cd .. && ${MAKE} ${MAXJOBS} config ${c}"
10519 if [ -f .ccac.h ] && ${cmp} mk-config.h .ccac.h; then
10520 printf 'Skipping after config, nothing changed\n'
10521 printf 'Skipping after config, nothing changed\n' >&2
10524 ${SHELL} -c "cd ../ && ${MAKE} ${MAXJOBS} build test"
10527 cd .. && ${MAKE} distclean
10532 if [ -z "${CHECK}${RUN_TEST}" ]; then
10536 if have_feat debug; then
10537 if have_feat devel; then
10541 ARGS="${ARGS} -Smemdebug"
10542 JOBWAIT=`add
$JOBWAIT $JOBWAIT`
10544 elif have_feat devel; then
10547 LOOPS_MAX=${LOOPS_BIG}
10551 if [ -z "${RUN_TEST}" ] || [ ${#} -eq 0 ]; then
10553 printf 'Will do up to %s tests in parallel, with a %s second timeout\n' \
10554 ${MAXJOBS} ${JOBWAIT}
10560 printf 'Tests have a %s second timeout\n' ${JOBWAIT}
10562 while [ ${#} -gt 0 ]; do
10572 printf '%u tests: %s%u ok%s, %s%u failure(s)%s. %s%u test(s) skipped%s\n' \
10573 "${TESTS_PERFORMED}" "${COLOR_OK_ON}" "${TESTS_OK}" "${COLOR_OK_OFF}" \
10574 "${COLOR_ERR_ON}" "${TESTS_FAILED}" "${COLOR_ERR_OFF}" \
10575 "${COLOR_WARN_ON}" "${TESTS_SKIPPED}" "${COLOR_WARN_OFF}"
10576 if [ -n "${ssec}" ] && [ -n "${esec}" ]; then
10577 ( echo 'Elapsed seconds: '`$awk 'BEGIN{print '"${esec}"' - '"${ssec}"'}'` )