summaryrefslogtreecommitdiff
path: root/regress/simulation/emul_fmlpl_command.sh
blob: 813c40cd0bfb9081d0a47a766735964ca27f9974 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
#
# $FML: emul_fmlpl_command.sh,v 1.2 2004/12/29 10:27:30 fukachan Exp $
#

buf=$PWD/__command$$__
trap "rm -f $buf" 0 1 3 15

header_file=${header:-text=empty}

# option
option=${OPTION:-test_key=test_value}


DO () {
   (
	pwd=`pwd`
	cd ../.. || exit 1
	pwd

	test -f $msg || return;

	maincf=/tmp/main.cf.$$
	trap "rm -f $maincf" 0 1 3 15
	sed 	-e "s@\$pwd@$PWD@g" \
		-e "s@^debug.*@debug = $debug@" \
		regress/simulation/main.cf > $maincf


	cp fml/libexec/loader /tmp/fml.pl

	env MODE=command regress/message/scramble.pl $msg |\
	${PERL:-perl} -w /tmp/fml.pl -c $maincf \
		-o $option \
		--ctladdr \
		/var/spool/ml/elena
	echo "-- exit code: $?"
   )
}

(cd ../../fml/etc/; cp config.cf.ja config.cf )
(cd ../../fml/etc/; sh .gen.sh)

cat ./../testmails/$header_file > $buf
cat >> $buf

list=$buf

for msg in $list
do
   DO $msg
done

exit 0