SHELL	= /bin/sh
SRCS	= postconf.c postconf_builtin.c postconf_edit.c postconf_main.c \
	postconf_master.c postconf_misc.c postconf_node.c postconf_other.c \
	postconf_service.c postconf_unused.c postconf_user.c postconf_dbms.c \
	postconf_lookup.c postconf_match.c postconf_print.c
OBJS	= postconf.o postconf_builtin.o postconf_edit.o postconf_main.o \
	postconf_master.o postconf_misc.o postconf_node.o postconf_other.o \
	postconf_service.o postconf_unused.o postconf_user.o postconf_dbms.o \
	postconf_lookup.o postconf_match.o postconf_print.o
HDRS	= postconf.h
TESTSRC	=
DEFS	= -I. -I$(INC_DIR) -D$(SYSTYPE) -DLEGACY_DBMS_SUPPORT
CFLAGS	= $(DEBUG) $(OPT) $(DEFS)
TESTPROG=
MAKES	= bool_table.h bool_vars.h int_table.h int_vars.h str_table.h \
	str_vars.h time_table.h time_vars.h raw_table.h raw_vars.h \
	nint_table.h nint_vars.h nbool_table.h nbool_vars.h long_table.h \
	long_vars.h str_fn_table.h str_fn_vars.h 
DB_MAKES= pcf_ldap_suffixes.h pcf_memcache_suffixes.h pcf_mysql_suffixes.h \
	pcf_pgsql_suffixes.h pcf_sqlite_suffixes.h
TEST_TMP= main.cf master.cf test*.tmp
DUMMIES	= makes_dummy # for "make -j"
PROG	= postconf
SAMPLES	= ../../conf/main.cf.default
INC_DIR	= ../../include
LIBS	= ../../lib/libxsasl.a \
	../../lib/lib$(LIB_PREFIX)tls$(LIB_SUFFIX) \
	../../lib/lib$(LIB_PREFIX)dns$(LIB_SUFFIX) \
	../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
	../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
HTABLE_FIX = NORANDOMIZE=1

.c.o:;	$(CC) $(CFLAGS) -c $*.c

$(PROG): $(OBJS) $(LIBS)
	$(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)

../../conf/main.cf.default: $(PROG) Makefile
	rm -f $@
	(echo "# DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE"; \
	 echo "# TEXT HERE JUST SHOWS DEFAULT SETTINGS BUILT INTO POSTFIX."; \
	 echo "#"; $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -d -c ../../conf) | \
	    grep -E -v '^(myhostname|mydomain|mynetworks|process_name|process_id) ' >$@

$(OBJS): ../../conf/makedefs.out

Makefile: Makefile.in
	cat ../../conf/makedefs.out $? >$@

test:	$(TESTPROG)

tests: test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 \
	test12 test13 test14 test15 test16 test17 test18 test19 test20 test21 \
	test22 test23 test24 test25 test26 test27 test28 test29 test30 test4b \
	test31 test32 test33 test34 test35 test36 test37 test39 test40 test41 \
	test42 test43 test44 test45 test46 test47 test48 test49 test50 test51 \
	test52 test53 test54 test55 test56 test57 test58 test59 test60 test61 \
	test62 test63 test64 test65 test66 test67 test68 test69 test70 test71

root_tests:

update: ../../bin/$(PROG) $(SAMPLES)

../../bin/$(PROG): $(PROG)
	cp $(PROG) ../../bin

$(MAKES): makes_dummy

makes_dummy: $(INC_DIR)/mail_params.h ../global/mail_params.c extract.awk Makefile.in
	$(AWK) -f extract.awk ../*/*.c | $(SHELL)
	touch makes_dummy

$(DB_MAKES): extract_cfg.sh Makefile.in 

pcf_ldap_suffixes.h: ../global/dict_ldap.c 
	sh extract_cfg.sh -d ../global/dict_ldap.c > $@

pcf_memcache_suffixes.h: ../global/dict_memcache.c 
	sh extract_cfg.sh -d ../global/dict_memcache.c > $@

pcf_mysql_suffixes.h: ../global/dict_mysql.c 
	sh extract_cfg.sh -d -s ../global/dict_mysql.c > $@

pcf_pgsql_suffixes.h: ../global/dict_pgsql.c 
	sh extract_cfg.sh -d -s ../global/dict_pgsql.c > $@

pcf_sqlite_suffixes.h: ../global/dict_sqlite.c
	sh extract_cfg.sh -d -s ../global/dict_sqlite.c > $@

# Define two parameters with smtpd_restriction_classes. One will be ignored.

test1:	$(PROG) test1.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo smtpd_restriction_classes = foo bar >> main.cf
	echo foo = yes >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test1.tmp 2>&1
	diff test1.ref test1.tmp
	rm -f main.cf master.cf test1.tmp

# Define two unused parameters. Expect two warnings.

test2:	$(PROG) test2.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo restriction_classes = foo bar >> main.cf
	echo foo = yes >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test2.tmp 2>&1
	diff test2.ref test2.tmp
	rm -f main.cf master.cf test2.tmp

# Define one parameter in main.cf, validate it with main.cf.

test3:	$(PROG) test3.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo = yes >> main.cf
	echo 'bar = $$foo' >> main.cf
	echo 'always_bcc = $$bar' >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test3.tmp 2>&1
	diff test3.ref test3.tmp
	rm -f main.cf master.cf test3.tmp

# Define one parameter in main.cf, validate it with master.cf.

test4:	$(PROG) test4.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo = yes >> main.cf
	echo 'bar = $$foo' >> main.cf
	echo smtpd unix - n n - 0 smtpd >> master.cf
	echo ' -o always_bcc=$$bar' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test4.tmp 2>&1
	diff test4.ref test4.tmp
	rm -f main.cf master.cf test4.tmp

# Define one parameter in master.cf, validate it with main.cf.

test4b:	$(PROG) test4b.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo 'always_bcc = $$foo' >> main.cf
	echo 'biff = $$bar' >> main.cf
	echo 'bar = aaa' >> main.cf
	echo smtpd1 unix - n n - 0 smtpd >> master.cf
	echo ' -o foo=xxx -o bar=yyy -o baz=zzz' >> master.cf
	echo '#smtpd2 unix - n n - 0 smtpd' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test4b.tmp 2>&1
	diff test4b.ref test4b.tmp
	rm -f main.cf master.cf test4b.tmp

# Define one user-defined parameter with name=value in master.cf,
# validate it with known_parameter=$$name in master.cf.

test5:	$(PROG) test5.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo smtpd unix - n n - 0 smtpd >> master.cf
	echo ' -o bar=yes -o always_bcc=$$bar -o' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test5.tmp 2>&1
	diff test5.ref test5.tmp
	rm -f main.cf master.cf test5.tmp

# Basic functionality test: service parameters for delivery agents.

test6:	$(PROG) test6.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo whatevershebrings unix - n n - 0 pipe >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c . 2>&1 | grep whatevershebrings >test6.tmp
	diff test6.ref test6.tmp
	rm -f main.cf master.cf test6.tmp

# Basic functionality test: service parameters for spawn programs.

test7:	$(PROG) test7.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo whatevershebrings unix - n n - 0 spawn >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c . 2>&1 | grep whatevershebrings >test7.tmp
	diff test7.ref test7.tmp
	rm -f main.cf master.cf test7.tmp

test8:	$(PROG) test8.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo whatevershebrings inet - n n - 0 spawn >> master.cf
	echo whatevershebrings_time_limit=1 >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c . 2>&1 | grep whatevershebrings >test8.tmp
	diff test8.ref test8.tmp
	rm -f main.cf master.cf test8.tmp

test9:	$(PROG) test9.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo inet - n n - 0 spawn >> master.cf
	echo bar unix - n n - 0 spawn >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c . -M '*'/inet >test9.tmp 2>&1
	diff test9.ref test9.tmp
	rm -f main.cf master.cf test9.tmp

test10:	$(PROG) test10.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo inet - n n - 0 spawn >> master.cf
	echo bar unix - n n - 0 spawn >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c . -M bar/inet foo/unix >test10.tmp 2>&1
	diff test10.ref test10.tmp
	rm -f main.cf master.cf test10.tmp

test11:	$(PROG) test11.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo inet - n n - 0 spawn >> master.cf
	echo bar unix - n n - 0 spawn >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c . -M >test11.tmp 2>&1
	diff test11.ref test11.tmp
	rm -f main.cf master.cf test11.tmp

# Duplicate service entry.

test12:	$(PROG) test12.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo bar=yes >> main.cf
	echo foo inet - n n - 0 spawn >> master.cf
	echo ' -o always_bcc=$$bar -o' >> master.cf
	echo foo inet - n n - 0 spawn >> master.cf
	echo ' -o always_bcc=$$bar -o' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c . -M >test12.tmp 2>&1
	diff test12.ref test12.tmp
	rm -f main.cf master.cf test12.tmp

# Define parameter with restriction_classes in master.cf, validate in main.cf.

test13:	$(PROG) test13.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo bar=yes >> main.cf
	echo baz=xx >> main.cf
	echo foo inet - n n - 0 spawn >> master.cf
	echo ' -o smtpd_restriction_classes=bar' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test13.tmp 2>&1
	diff test13.ref test13.tmp
	rm -f main.cf master.cf test13.tmp

# Define parameter with restriction_classes in main.cf, validate in master.cf.

test14:	$(PROG) test14.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo smtpd_restriction_classes=bar >> main.cf
	echo foo inet - n n - 0 spawn >> master.cf
	echo ' -o bar=yes -o baz=xx' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test14.tmp 2>&1
	diff test14.ref test14.tmp
	rm -f main.cf master.cf test14.tmp

# Define two parameters, one is hidden by master.cf.

test15:	$(PROG) test15.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo bar=xx >> main.cf
	echo baz=yy >> main.cf
	echo foo inet - n n - 0 spawn >> master.cf
	echo ' -o bar=yes -o always_bcc=$$bar$$baz' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test15.tmp 2>&1
	diff test15.ref test15.tmp
	rm -f main.cf master.cf test15.tmp

# Test graceful degradation if master.cf is unavailable.

test16:	$(PROG) test16.ref
	rm -f main.cf master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test16.tmp 2>&1
	diff test16.ref test16.tmp
	rm -f main.cf master.cf test16.tmp

test17:	$(PROG) test17.ref
	rm -f main.cf master.cf
	touch -t 197101010000 main.cf
	-$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mc . >test17.tmp 2>&1; exit 0
	diff test17.ref test17.tmp
	rm -f main.cf master.cf test17.tmp

# Test legacy $name in built-in defaults.

test18:	$(PROG) test18.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo virtual_maps=xxx >> main.cf
	echo smtpd_client_connection_limit_exceptions=yyy >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test18.tmp 2>&1
	diff test18.ref test18.tmp
	rm -f main.cf master.cf test18.tmp

# Test $name in "raw" parameters.

test19:	$(PROG) test19.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo forward_path='$$'aaaa >> main.cf
	echo default_rbl_reply='$$'bbbb >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test19.tmp 2>&1
	diff test19.ref test19.tmp
	rm -f main.cf master.cf test19.tmp

# Test master.cf line folding.

test20:	$(PROG) test20.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo inet - n n - 0 spawn >> master.cf
	echo ' -o always_bcc=$$bar$$baz' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc . >test20.tmp 2>&1
	diff test20.ref test20.tmp
	rm -f main.cf master.cf test20.tmp

# Test main.cf line folding.

test21:	$(PROG) test21.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo forward_path = xxxxxxxxxxxxx xxxxxxxxxxxxxx xxxxxxxxxxxx \
	    xxxxxxxxxxxxx xxxxxxxxxxxxxx >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nfc . >test21.tmp 2>&1
	diff test21.ref test21.tmp
	rm -f main.cf master.cf test21.tmp

# Like test6, but using a delivery agent that has no _time_limit magic.

test22:	$(PROG) test22.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo whatevershebrings unix - n n - 0 smtp >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c . 2>&1 | grep whatevershebrings >test22.tmp
	diff test22.ref test22.tmp
	rm -f main.cf master.cf test22.tmp

# Test the -C flag for each category.

test23:	$(PROG) test23.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo always_bcc = yes >> main.cf
	echo name = value >> main.cf
	echo whatevershebrings unix - n n - 0 smtp >> master.cf
	echo ' -o always_bcc=$$name' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c . -nC builtin >test23.tmp 2>&1
	diff test23.ref test23.tmp
	rm -f main.cf master.cf test23.tmp

test24:	$(PROG) test24.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo always_bcc = yes >> main.cf
	echo name = value >> main.cf
	echo whatevershebrings unix - n n - 0 smtp >> master.cf
	echo ' -o always_bcc=$$name' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c . -nC user >test24.tmp 2>&1
	diff test24.ref test24.tmp
	rm -f main.cf master.cf test24.tmp

test25:	$(PROG) test25.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo always_bcc = yes >> main.cf
	echo name = value >> main.cf
	echo whatevershebrings unix - n n - 0 smtp >> master.cf
	echo ' -o always_bcc=$$name' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c . -C service 2>&1 | grep whatevershebrings >test25.tmp
	diff test25.ref test25.tmp
	rm -f main.cf master.cf test25.tmp

# Test completeness of "-C all".

test26:	$(PROG) test26.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo always_bcc = yes >> main.cf
	echo name = value >> main.cf
	echo whatevershebrings unix - n n - 0 smtp >> master.cf
	echo ' -o always_bcc=$$name' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . -C all >test26.tmp 2>&1
	diff test26.ref test26.tmp
	rm -f main.cf master.cf test26.tmp

test27:	$(PROG) test27.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo always_bcc = yes >> main.cf
	echo name = value >> main.cf
	echo whatevershebrings unix - n n - 0 smtp >> master.cf
	echo ' -o always_bcc=$$name' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c . -C all 2>&1 | grep whatevershebrings >test27.tmp
	diff test27.ref test27.tmp
	rm -f main.cf master.cf test27.tmp

# Test macro expansion, type:table parsing and scoping.

test28:	$(PROG) test28.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo 'xx = proxy:ldap:foo' >> main.cf
	echo 'foo_domain = bar' >> main.cf
	echo 'header_checks = ldap:hh' >> main.cf
	echo 'hh_domain = whatever' >> main.cf
	echo 'zz = $$yy' >> main.cf
	echo 'yy = aap' >> main.cf
	echo 'db = memcache' >> main.cf
	echo whatevershebrings unix - n n - 0 other >> master.cf
	echo ' -o body_checks=$$db:$$zz' >> master.cf
	echo 'aap_domain = whatever' >> main.cf
	echo 'aa_domain = whatever' >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test28.tmp 2>&1
	diff test28.ref test28.tmp
	rm -f main.cf master.cf test28.tmp

# Test the handling of known and unknown database-defined suffixes.

test29:	$(PROG) test29.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo 'ldapxx = proxy:ldap:ldapfoo' >> main.cf
	echo 'ldapfoo_domain = bar' >> main.cf
	echo 'ldapfoo_domainx = bar' >> main.cf
	echo 'mysqlxx = proxy:mysql:mysqlfoo' >> main.cf
	echo 'mysqlfoo_domain = bar' >> main.cf
	echo 'mysqlfoo_domainx = bar' >> main.cf
	echo 'pgsqlxx = proxy:pgsql:pgsqlfoo' >> main.cf
	echo 'pgsqlfoo_domain = bar' >> main.cf
	echo 'pgsqlfoo_domainx = bar' >> main.cf
	echo 'sqlitexx = proxy:sqlite:sqlitefoo' >> main.cf
	echo 'sqlitefoo_domain = bar' >> main.cf
	echo 'sqlitefoo_domainx = bar' >> main.cf
	echo 'memcachexx = proxy:memcache:memcachefoo' >> main.cf
	echo 'memcachefoo_domain = bar' >> main.cf
	echo 'memcachefoo_domainx = bar' >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test29.tmp 2>&1
	diff test29.ref test29.tmp
	rm -f main.cf master.cf test29.tmp

test30:	$(PROG) test30.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo p1=xx >> main.cf
	echo p2=xx >> main.cf
	echo p3=xx >> main.cf
	echo p4=xx >> main.cf
	echo whatevershebrings unix - n n - 0 other >> master.cf
	echo ' -o body_checks=$$p1' >> master.cf
	echo ' -o bodyx_checks=$$p2' >> master.cf
	echo ' -oheader_checks=$$p3' >> master.cf
	echo ' -oheaderx_checks=$$p4' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test30.tmp 2>&1
	diff test30.ref test30.tmp
	rm -f main.cf master.cf test30.tmp

# Does a non-default setting propagate to a non-default value?

test31:	$(PROG) test31.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo 'smtpd_helo_restrictions=whatever' >> main.cf
	echo 'smtpd_sender_restrictions=$$smtpd_helo_restrictions' >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nxc . >test31.tmp 2>&1
	diff test31.ref test31.tmp
	rm -f main.cf master.cf test31.tmp

# Does a non-default setting propagate to a default value?

test32:	$(PROG) test32.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo 'relay_domains=whatever' >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -xc . fast_flush_domains >test32.tmp 2>&1
	diff test32.ref test32.tmp
	rm -f main.cf master.cf test32.tmp

# Does a default setting propagate to a non-default value?

test33:	$(PROG) test33.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo 'mydestination=whatever' >> main.cf
	echo 'always_bcc=$$relay_domains' >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -xc . always_bcc >test33.tmp 2>&1
	diff test33.ref test33.tmp
	rm -f main.cf master.cf test33.tmp

test34:	$(PROG) test34.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo 'mydestination=whatever' >> main.cf
	echo 'process_name=xxx' >> main.cf
	echo 'process_id=yyy' >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -xc . mydestination process_name >test34.tmp 2>&1
	diff test34.ref test34.tmp
	rm -f main.cf master.cf test34.tmp

test35:	$(PROG) test35.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo whatevershebrings unix - n n - 0 other >> master.cf
	echo ' -o body_checks=whatever' >> master.cf
	echo ' -o process_name=aaa' >> master.cf
	echo ' -o process_id=bbb' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -xc . process_name >test35.tmp 2>&1
	diff test35.ref test35.tmp
	rm -f main.cf master.cf test35.tmp

test36:	$(PROG) test36.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo 'mydestination=$$virtual_mapx' >> main.cf
	echo 'virtual_alias_maps=$$virtual_maps' >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nxc . >test36.tmp 2>&1
	diff test36.ref test36.tmp
	rm -f main.cf master.cf test36.tmp

test37: $(PROG) test37.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo 'xxx=yyy' >> main.cf
	echo 'aaa=bbb' >> main.cf
	echo whatever unix - n n - 0 other >> master.cf
	echo ' -o mydestination=$$xxx' >> master.cf
	echo ' -o always_bcc=$$aaa' >> master.cf
	echo ' -o aaa=ccc' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfxc . >test37.tmp 2>&1
	diff test37.ref test37.tmp
	rm -f main.cf master.cf test37.tmp

test39: $(PROG) test39.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar inet - n n - 0 other >> master.cf
	echo baz unix - n n - 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc . '*'/unix >test39.tmp 2>&1
	diff test39.ref test39.tmp
	rm -f main.cf master.cf test39.tmp

test40: $(PROG) test40.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo ' -voaaa=bbb' >> master.cf
	echo ' -vo ccc=$$aaa' >> master.cf
	echo ' -v -oddd=$$ccc' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfxc . '*'/unix >test40.tmp 2>&1
	diff test40.ref test40.tmp
	rm -f main.cf master.cf test40.tmp

test41: $(PROG) test41.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar unix - n n - 0 other >> master.cf
	echo baz unix - n n - 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Pc . bar/unix/xxx=yyy bar/unix/aaa=bbb >test41.tmp 2>&1
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >>test41.tmp 2>&1
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Pc . bar/unix/xxx=YYY bar/unix/aaa=BBB >>test41.tmp 2>&1
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >>test41.tmp 2>&1
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Pc . >>test41.tmp 2>&1
	diff test41.ref test41.tmp
	rm -f main.cf master.cf test41.tmp

test42: $(PROG) test42.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar unix - n n - 0 other >> master.cf
	echo baz unix - n n - 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Pc . bar/unix/xxx=yyy bar/unix/aaa=bbb >test42.tmp 2>&1
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >>test42.tmp 2>&1
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Pc . >>test42.tmp 2>&1
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -PXc. bar/unix/xxx bar/unix/aaa >>test42.tmp 2>&1
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >>test42.tmp 2>&1
	diff test42.ref test42.tmp
	rm -f main.cf master.cf test42.tmp

test43: $(PROG) test43.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar unix - n n - 0 other >> master.cf
	echo baz unix - n n - 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Fc . bar/unix/chroot=y bar/unix/command='aa -stuffobb=cc dd' >test43.tmp 2>&1
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >>test43.tmp 2>&1
	diff test43.ref test43.tmp
	rm -f main.cf master.cf test43.tmp

test44: $(PROG) test44.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar unix - n n - 0 other >> master.cf
	echo baz unix - n n - 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mc . bar/unix='xx inet - n n - 0 aa -stuffobb=cc dd' >test44.tmp 2>&1
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >>test44.tmp 2>&1
	diff test44.ref test44.tmp
	rm -f main.cf master.cf test44.tmp

test45: $(PROG) test45.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar xxxx - n n - 0 other >> master.cf
	echo baz unix - n n - 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >test45.tmp 2>&1 || true
	diff test45.ref test45.tmp
	rm -f main.cf master.cf test45.tmp

test46: $(PROG) test46.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar inet X n n - 0 other >> master.cf
	echo baz unix - n n - 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >test46.tmp 2>&1 || true
	diff test46.ref test46.tmp
	rm -f main.cf master.cf test46.tmp

test47: $(PROG) test47.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar inet - X n - 0 other >> master.cf
	echo baz unix - n n - 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >test47.tmp 2>&1 || true
	diff test47.ref test47.tmp
	rm -f main.cf master.cf test47.tmp

test48: $(PROG) test48.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar inet - n X - 0 other >> master.cf
	echo baz unix - n n - 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >test48.tmp 2>&1 || true
	diff test48.ref test48.tmp
	rm -f main.cf master.cf test48.tmp

test49: $(PROG) test49.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar inet - n n X 0 other >> master.cf
	echo baz unix - n n - 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >test49.tmp 2>&1 || true
	diff test49.ref test49.tmp
	rm -f main.cf master.cf test49.tmp

test50: $(PROG) test50.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar inet - n n - X other >> master.cf
	echo baz unix - n n - 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >test50.tmp 2>&1 || true
	diff test50.ref test50.tmp
	rm -f main.cf master.cf test50.tmp

test51: $(PROG) test51.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n -? 0 other >> master.cf
	echo bar inet - n n X? 0 other >> master.cf
	echo baz unix - n n 0? 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >test51.tmp 2>&1 || true
	diff test51.ref test51.tmp
	rm -f main.cf master.cf test51.tmp

test52: $(PROG) test52.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar inet - n n 0 0 other >> master.cf
	echo baz unix - n n 0 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -MXc. bar/inet foo/unix xxx/yyy
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >test52.tmp 2>&1 || true
	diff test52.ref test52.tmp
	rm -f main.cf master.cf test52.tmp

test53: $(PROG) test53.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar inet - n n 0 0 other >> master.cf
	echo baz unix - n n 0 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -M#c. bar/inet xxx/yyy
	diff test53.ref master.cf
	rm -f main.cf master.cf test53.tmp

test54: $(PROG) test54.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar inet - n n 0 0 other >> master.cf
	echo baz unix - n n 0 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -M#c. bar/inet foo/unix
	diff test54.ref master.cf
	rm -f main.cf master.cf test54.tmp

test55: $(PROG) test55.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar inet - n n 0 0 other >> master.cf
	echo baz unix - n n 0 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -M#c. bar/inet baz/unix
	diff test55.ref master.cf
	rm -f main.cf master.cf test55.tmp

test56: $(PROG) test56.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar inet - n n 0 0 other >> master.cf
	echo " -o first" >> master.cf
	echo " -o second" >> master.cf
	echo baz unix - n n 0 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -M#c. bar/inet xxx/yyy
	diff test56.ref master.cf
	rm -f main.cf master.cf test56.tmp

# Many more tests in util/mac_expand.in.

test57: $(PROG) test57.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo 'x = $${{1} == {2}?{error}:x-value}' >> main.cf
	echo 'y = y-value' >> main.cf
	echo 'bar = $${x?{$$y}:$$z}' >> main.cf
	echo 'baz = $${x?{$$z}:$$y}' >> main.cf
	echo 'foo = $$bar$$baz' >> main.cf
	echo 't1 = Postfix 2.11 $${{$${x?bug:x}} == {bug}?in}compatible' >> main.cf
	echo 't2 = $$t1' >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nxc. >test57.tmp 2>&1
	diff test57.ref test57.tmp
	rm -f main.cf master.cf test57.tmp

test58: $(PROG) test58.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo 'mydestination = foo bar pipemap:{ldap:xxx, memcache:yy}x randmap:{xx' >> main.cf
	echo 'xxx_domain = foo' >> main.cf
	echo 'xxx_bogus = foo' >> main.cf
	echo 'yy_backup = bbb' >> main.cf
	echo 'yy_bogus = bbb' >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./postconf -nc. >test58.tmp 2>&1 || true
	diff test58.ref test58.tmp
	rm -f main.cf master.cf test58.tmp

test59: $(PROG) test59.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo bar inet - n n 0 0 other >> master.cf
	echo " -o name1=value1" >> master.cf
	echo " -o { name2 = value2a value2b }" >> master.cf
	echo " { arg1a arg1b }" >> master.cf
	echo " { arg2a arg2b }x" >> master.cf
	echo " { arg3a arg3b " >> master.cf
	echo baz unix - n n 0 0 other >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Mfc. >test59.tmp 2>&1 || true
	diff test59.ref test59.tmp
	rm -f main.cf master.cf test59.tmp

test60: $(PROG) test60.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo ' -o always_bcc=bar' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Fhc. >test60.tmp 2>&1 || true
	diff test60.ref test60.tmp
	rm -f main.cf master.cf test60.tmp

test61: $(PROG) test61.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo ' -o always_bcc=bar' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -Phc. >test61.tmp 2>&1 || true
	diff test61.ref test61.tmp
	rm -f main.cf master.cf test61.tmp

test62: $(PROG) test62.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo ' -o always_bcc=bar' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -FHc. >test62.tmp 2>&1 || true
	diff test62.ref test62.tmp
	rm -f main.cf master.cf test62.tmp

test63: $(PROG) test63.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo foo unix - n n - 0 other >> master.cf
	echo ' -o always_bcc=bar' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -PHc. >test63.tmp 2>&1 || true
	diff test63.ref test63.tmp
	rm -f main.cf master.cf test63.tmp

# main.cf overrides built-in default.

test64: $(PROG) test64.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo 'relayhost = relay-from-main.cf' >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c. relayhost >test64.tmp 2>&1
	diff test64.ref test64.tmp
	rm -f main.cf master.cf test64.tmp

# '-o name=value' overrides main.cf.

test65: $(PROG) test65.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo 'relayhost = relay-from-main.cf' >> main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c. -o relayhost=relay-from-cmd-line relayhost >test65.tmp 2>&1
	diff test65.ref test65.tmp
	rm -f main.cf master.cf test65.tmp

# unknown parameters in database configuration file (absolute pathname).

test66: $(PROG) test66.ref
	rm -f main.cf master.cf
	touch master.cf
	echo alias_maps = ldap:`pwd`/test66.cf >> main.cf
	echo " " mysql:`pwd`/test66.cf >> main.cf
	echo " " pgsql:`pwd`/test66.cf >> main.cf
	echo " " sqlite:`pwd`/test66.cf >> main.cf
	echo " " memcache:`pwd`/test66.cf >> main.cf
	echo junk = junk >> test66.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c. 2>test66.tmp >/dev/null
	sed "s;PWD;`pwd`;" test66.ref | diff - test66.tmp
	rm -f main.cf master.cf test66.tmp test66.cf

# expand process name and service name in master.cf.

test67: $(PROG) test67.ref
	rm -f main.cf master.cf
	touch master.cf
	echo 'smtp inet n - n - - smtpd' >>master.cf
	echo ' -o test1_process_name=$$process_name' >> master.cf
	echo ' -o test1_service_name=$$service_name' >> master.cf
	echo 'smtp unix n - n - - smtp' >>master.cf
	echo ' -o test2_process_name=$$process_name' >> master.cf
	echo ' -o test2_service_name=$$service_name' >> master.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -xMfc. >test67.tmp 2>&1
	diff test67.ref test67.tmp
	rm -f main.cf master.cf test67.tmp

test68: $(PROG) test68.ref
	rm -f main.cf master.cf
	touch master.cf
	echo foo = ldap:`pwd` >> main.cf
	echo 'alias_maps = $$foo/test68.cf' >> main.cf
	echo " " mysql:`pwd`/test68.cf >> main.cf
	echo " " pgsql:`pwd`/test68.cf >> main.cf
	echo " " sqlite:`pwd`/test68.cf >> main.cf
	echo " " memcache:`pwd`/test68.cf >> main.cf
	echo junk = junk >> test68.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -c. 2>test68.tmp >/dev/null
	sed "s;PWD;`pwd`;" test68.ref | diff - test68.tmp
	rm -f main.cf master.cf test68.tmp test68.cf

# See also test28 for user-defined parameters defined in main.cf.

test69:	$(PROG) test69.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo whatevershebrings unix - n n - 0 other >> master.cf
	echo " -o ldap=ldap:`pwd`" >> master.cf
	echo ' -o body_checks=$$ldap/test69.cf' >> master.cf
	echo junk = junk >> test69.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test69.tmp 2>&1
	sed "s;PWD;`pwd`;" test69.ref | diff - test69.tmp
	rm -f main.cf master.cf test69.tmp test69.cf

# Nasty nesting. Prove that the ldap table is detected. If support for
# legacy table syntax is dropped, replace ldap:xyz with ldap:`pwd`/xyz
# and update the good/bad parameter name tests.

test70:	$(PROG) test70.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo "smtpd_client_restrictions = check_sender_access {" >>main.cf
	echo "  pipemap:{ldap:used} { search_order = foo, bar } }"  >>main.cf
	echo "used_server_host = 127.0.0.1"  >>main.cf
	echo "unused_server_host = 127.0.0.1"  >>main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test70.tmp 2>&1
	diff test70.ref test70.tmp
	rm -f main.cf master.cf test70.tmp

test71:	$(PROG) test71.ref
	rm -f main.cf master.cf
	touch main.cf master.cf
	echo "smtpd_client_restrictions = inline:{" >>main.cf
	echo "	{" >>main.cf
	echo "	aaa0 = #aaa1" >>main.cf
	echo "	} #aaa2" >>main.cf
	echo " }" >>main.cf
	echo "smtpd_helo_restrictions = pcre:{" >>main.cf
	echo "	{" >>main.cf
	echo "	/bbb0 #bbb1/" >>main.cf
	echo "	} #bbb2" >>main.cf
	echo " }" >>main.cf
	echo "smtpd_sender_restrictions = regexp:{" >>main.cf
	echo "	{" >>main.cf
	echo "	/ccc0 #ccc1/" >>main.cf
	echo "	} #ccc2" >>main.cf
	echo " }" >>main.cf
	touch -t 197101010000 main.cf
	$(HTABLE_FIX) $(SHLIB_ENV) $(VALGRIND) ./$(PROG) -nc . >test71.tmp 2>&1
	diff test71.ref test71.tmp
	rm -f main.cf master.cf test71.tmp

printfck: $(OBJS) $(PROG)
	rm -rf printfck
	mkdir printfck
	cp *.h printfck
	sed '1,/^# do not edit/!d' Makefile >printfck/Makefile
	set -e; for i in *.c; do printfck -f .printfck $$i >printfck/$$i; done
	cd printfck; make "INC_DIR=../../../include" `cd ..; ls *.o`

lint:
	lint $(DEFS) $(SRCS) $(LINTFIX)

clean:
	rm -f *.o *core $(PROG) $(TESTPROG) junk $(MAKES) $(AUTOS) $(DUMMIES) \
	$(TEST_TMP) $(DB_MAKES)
	rm -rf printfck

tidy:	clean

depend: $(MAKES)
	(sed '1,/^# do not edit/!d' Makefile.in; \
	set -e; for i in [a-z][a-z0-9]*.c; do \
	    $(CC) -E $(DEFS) $(INCL) $$i | grep -v '[<>]' | sed -n -e '/^# *1 *"\([^"]*\)".*/{' \
	    -e 's//'`echo $$i|sed 's/c$$/o/'`': \1/' \
	    -e 's/o: \.\//o: /' -e p -e '}' ; \
	done | LANG=C sort -u) | grep -v '[.][o][:][ ][/]' >$$$$ && mv $$$$ Makefile.in
	@$(EXPORT) make -f Makefile.in Makefile 1>&2

# do not edit below this line - it is generated by 'make depend'
postconf.o: ../../include/argv.h
postconf.o: ../../include/check_arg.h
postconf.o: ../../include/compat_level.h
postconf.o: ../../include/dict.h
postconf.o: ../../include/htable.h
postconf.o: ../../include/mail_conf.h
postconf.o: ../../include/mail_dict.h
postconf.o: ../../include/mail_params.h
postconf.o: ../../include/mail_run.h
postconf.o: ../../include/mail_version.h
postconf.o: ../../include/msg.h
postconf.o: ../../include/msg_vstream.h
postconf.o: ../../include/myflock.h
postconf.o: ../../include/mymalloc.h
postconf.o: ../../include/name_code.h
postconf.o: ../../include/name_mask.h
postconf.o: ../../include/stringops.h
postconf.o: ../../include/sys_defs.h
postconf.o: ../../include/vbuf.h
postconf.o: ../../include/vstream.h
postconf.o: ../../include/vstring.h
postconf.o: ../../include/warn_stat.h
postconf.o: postconf.c
postconf.o: postconf.h
postconf_builtin.o: ../../include/argv.h
postconf_builtin.o: ../../include/attr.h
postconf_builtin.o: ../../include/check_arg.h
postconf_builtin.o: ../../include/dict.h
postconf_builtin.o: ../../include/get_hostname.h
postconf_builtin.o: ../../include/htable.h
postconf_builtin.o: ../../include/inet_proto.h
postconf_builtin.o: ../../include/iostuff.h
postconf_builtin.o: ../../include/mail_addr.h
postconf_builtin.o: ../../include/mail_conf.h
postconf_builtin.o: ../../include/mail_params.h
postconf_builtin.o: ../../include/mail_proto.h
postconf_builtin.o: ../../include/mail_version.h
postconf_builtin.o: ../../include/msg.h
postconf_builtin.o: ../../include/myflock.h
postconf_builtin.o: ../../include/mymalloc.h
postconf_builtin.o: ../../include/mynetworks.h
postconf_builtin.o: ../../include/name_code.h
postconf_builtin.o: ../../include/nvtable.h
postconf_builtin.o: ../../include/server_acl.h
postconf_builtin.o: ../../include/stringops.h
postconf_builtin.o: ../../include/sys_defs.h
postconf_builtin.o: ../../include/vbuf.h
postconf_builtin.o: ../../include/vstream.h
postconf_builtin.o: ../../include/vstring.h
postconf_builtin.o: bool_table.h
postconf_builtin.o: bool_vars.h
postconf_builtin.o: install_table.h
postconf_builtin.o: install_vars.h
postconf_builtin.o: int_table.h
postconf_builtin.o: int_vars.h
postconf_builtin.o: long_table.h
postconf_builtin.o: long_vars.h
postconf_builtin.o: nbool_table.h
postconf_builtin.o: nbool_vars.h
postconf_builtin.o: nint_table.h
postconf_builtin.o: nint_vars.h
postconf_builtin.o: postconf.h
postconf_builtin.o: postconf_builtin.c
postconf_builtin.o: raw_table.h
postconf_builtin.o: raw_vars.h
postconf_builtin.o: str_fn_table.h
postconf_builtin.o: str_fn_vars.h
postconf_builtin.o: str_table.h
postconf_builtin.o: str_vars.h
postconf_builtin.o: time_table.h
postconf_builtin.o: time_vars.h
postconf_dbms.o: ../../include/argv.h
postconf_dbms.o: ../../include/check_arg.h
postconf_dbms.o: ../../include/dict.h
postconf_dbms.o: ../../include/dict_ht.h
postconf_dbms.o: ../../include/dict_ldap.h
postconf_dbms.o: ../../include/dict_memcache.h
postconf_dbms.o: ../../include/dict_mysql.h
postconf_dbms.o: ../../include/dict_pcre.h
postconf_dbms.o: ../../include/dict_pgsql.h
postconf_dbms.o: ../../include/dict_proxy.h
postconf_dbms.o: ../../include/dict_regexp.h
postconf_dbms.o: ../../include/dict_sqlite.h
postconf_dbms.o: ../../include/htable.h
postconf_dbms.o: ../../include/mac_expand.h
postconf_dbms.o: ../../include/mac_parse.h
postconf_dbms.o: ../../include/mail_conf.h
postconf_dbms.o: ../../include/mail_params.h
postconf_dbms.o: ../../include/mkmap.h
postconf_dbms.o: ../../include/msg.h
postconf_dbms.o: ../../include/myflock.h
postconf_dbms.o: ../../include/mymalloc.h
postconf_dbms.o: ../../include/name_code.h
postconf_dbms.o: ../../include/split_at.h
postconf_dbms.o: ../../include/stringops.h
postconf_dbms.o: ../../include/sys_defs.h
postconf_dbms.o: ../../include/vbuf.h
postconf_dbms.o: ../../include/vstream.h
postconf_dbms.o: ../../include/vstring.h
postconf_dbms.o: pcf_ldap_suffixes.h
postconf_dbms.o: pcf_memcache_suffixes.h
postconf_dbms.o: pcf_mysql_suffixes.h
postconf_dbms.o: pcf_pgsql_suffixes.h
postconf_dbms.o: pcf_sqlite_suffixes.h
postconf_dbms.o: postconf.h
postconf_dbms.o: postconf_dbms.c
postconf_edit.o: ../../include/argv.h
postconf_edit.o: ../../include/check_arg.h
postconf_edit.o: ../../include/dict.h
postconf_edit.o: ../../include/edit_file.h
postconf_edit.o: ../../include/htable.h
postconf_edit.o: ../../include/mail_params.h
postconf_edit.o: ../../include/msg.h
postconf_edit.o: ../../include/myflock.h
postconf_edit.o: ../../include/mymalloc.h
postconf_edit.o: ../../include/name_code.h
postconf_edit.o: ../../include/readlline.h
postconf_edit.o: ../../include/split_at.h
postconf_edit.o: ../../include/stringops.h
postconf_edit.o: ../../include/sys_defs.h
postconf_edit.o: ../../include/vbuf.h
postconf_edit.o: ../../include/vstream.h
postconf_edit.o: ../../include/vstring.h
postconf_edit.o: ../../include/vstring_vstream.h
postconf_edit.o: postconf.h
postconf_edit.o: postconf_edit.c
postconf_lookup.o: ../../include/argv.h
postconf_lookup.o: ../../include/check_arg.h
postconf_lookup.o: ../../include/dict.h
postconf_lookup.o: ../../include/htable.h
postconf_lookup.o: ../../include/mac_expand.h
postconf_lookup.o: ../../include/mac_parse.h
postconf_lookup.o: ../../include/mail_conf.h
postconf_lookup.o: ../../include/msg.h
postconf_lookup.o: ../../include/myflock.h
postconf_lookup.o: ../../include/mymalloc.h
postconf_lookup.o: ../../include/name_code.h
postconf_lookup.o: ../../include/stringops.h
postconf_lookup.o: ../../include/sys_defs.h
postconf_lookup.o: ../../include/vbuf.h
postconf_lookup.o: ../../include/vstream.h
postconf_lookup.o: ../../include/vstring.h
postconf_lookup.o: postconf.h
postconf_lookup.o: postconf_lookup.c
postconf_main.o: ../../include/argv.h
postconf_main.o: ../../include/check_arg.h
postconf_main.o: ../../include/dict.h
postconf_main.o: ../../include/htable.h
postconf_main.o: ../../include/mac_expand.h
postconf_main.o: ../../include/mac_parse.h
postconf_main.o: ../../include/mail_conf.h
postconf_main.o: ../../include/mail_params.h
postconf_main.o: ../../include/msg.h
postconf_main.o: ../../include/myflock.h
postconf_main.o: ../../include/mymalloc.h
postconf_main.o: ../../include/name_code.h
postconf_main.o: ../../include/readlline.h
postconf_main.o: ../../include/stringops.h
postconf_main.o: ../../include/sys_defs.h
postconf_main.o: ../../include/vbuf.h
postconf_main.o: ../../include/vstream.h
postconf_main.o: ../../include/vstring.h
postconf_main.o: postconf.h
postconf_main.o: postconf_main.c
postconf_master.o: ../../include/argv.h
postconf_master.o: ../../include/check_arg.h
postconf_master.o: ../../include/dict.h
postconf_master.o: ../../include/htable.h
postconf_master.o: ../../include/mail_params.h
postconf_master.o: ../../include/master_proto.h
postconf_master.o: ../../include/msg.h
postconf_master.o: ../../include/myflock.h
postconf_master.o: ../../include/mymalloc.h
postconf_master.o: ../../include/name_code.h
postconf_master.o: ../../include/readlline.h
postconf_master.o: ../../include/split_at.h
postconf_master.o: ../../include/stringops.h
postconf_master.o: ../../include/sys_defs.h
postconf_master.o: ../../include/vbuf.h
postconf_master.o: ../../include/vstream.h
postconf_master.o: ../../include/vstring.h
postconf_master.o: postconf.h
postconf_master.o: postconf_master.c
postconf_match.o: ../../include/argv.h
postconf_match.o: ../../include/check_arg.h
postconf_match.o: ../../include/dict.h
postconf_match.o: ../../include/htable.h
postconf_match.o: ../../include/msg.h
postconf_match.o: ../../include/myflock.h
postconf_match.o: ../../include/mymalloc.h
postconf_match.o: ../../include/name_code.h
postconf_match.o: ../../include/split_at.h
postconf_match.o: ../../include/sys_defs.h
postconf_match.o: ../../include/vbuf.h
postconf_match.o: ../../include/vstream.h
postconf_match.o: ../../include/vstring.h
postconf_match.o: postconf.h
postconf_match.o: postconf_match.c
postconf_misc.o: ../../include/argv.h
postconf_misc.o: ../../include/check_arg.h
postconf_misc.o: ../../include/dict.h
postconf_misc.o: ../../include/htable.h
postconf_misc.o: ../../include/mail_conf.h
postconf_misc.o: ../../include/mail_params.h
postconf_misc.o: ../../include/myflock.h
postconf_misc.o: ../../include/mymalloc.h
postconf_misc.o: ../../include/name_code.h
postconf_misc.o: ../../include/safe.h
postconf_misc.o: ../../include/stringops.h
postconf_misc.o: ../../include/sys_defs.h
postconf_misc.o: ../../include/vbuf.h
postconf_misc.o: ../../include/vstream.h
postconf_misc.o: ../../include/vstring.h
postconf_misc.o: postconf.h
postconf_misc.o: postconf_misc.c
postconf_node.o: ../../include/argv.h
postconf_node.o: ../../include/check_arg.h
postconf_node.o: ../../include/dict.h
postconf_node.o: ../../include/htable.h
postconf_node.o: ../../include/msg.h
postconf_node.o: ../../include/myflock.h
postconf_node.o: ../../include/mymalloc.h
postconf_node.o: ../../include/name_code.h
postconf_node.o: ../../include/sys_defs.h
postconf_node.o: ../../include/vbuf.h
postconf_node.o: ../../include/vstream.h
postconf_node.o: ../../include/vstring.h
postconf_node.o: postconf.h
postconf_node.o: postconf_node.c
postconf_other.o: ../../include/argv.h
postconf_other.o: ../../include/check_arg.h
postconf_other.o: ../../include/dict.h
postconf_other.o: ../../include/dns.h
postconf_other.o: ../../include/htable.h
postconf_other.o: ../../include/mbox_conf.h
postconf_other.o: ../../include/msg.h
postconf_other.o: ../../include/myaddrinfo.h
postconf_other.o: ../../include/myflock.h
postconf_other.o: ../../include/name_code.h
postconf_other.o: ../../include/name_mask.h
postconf_other.o: ../../include/sock_addr.h
postconf_other.o: ../../include/sys_defs.h
postconf_other.o: ../../include/tls.h
postconf_other.o: ../../include/vbuf.h
postconf_other.o: ../../include/vstream.h
postconf_other.o: ../../include/vstring.h
postconf_other.o: ../../include/xsasl.h
postconf_other.o: postconf.h
postconf_other.o: postconf_other.c
postconf_print.o: ../../include/argv.h
postconf_print.o: ../../include/check_arg.h
postconf_print.o: ../../include/dict.h
postconf_print.o: ../../include/htable.h
postconf_print.o: ../../include/msg.h
postconf_print.o: ../../include/myflock.h
postconf_print.o: ../../include/name_code.h
postconf_print.o: ../../include/sys_defs.h
postconf_print.o: ../../include/vbuf.h
postconf_print.o: ../../include/vstream.h
postconf_print.o: ../../include/vstring.h
postconf_print.o: postconf.h
postconf_print.o: postconf_print.c
postconf_service.o: ../../include/argv.h
postconf_service.o: ../../include/check_arg.h
postconf_service.o: ../../include/dict.h
postconf_service.o: ../../include/htable.h
postconf_service.o: ../../include/mail_params.h
postconf_service.o: ../../include/msg.h
postconf_service.o: ../../include/myflock.h
postconf_service.o: ../../include/mymalloc.h
postconf_service.o: ../../include/name_code.h
postconf_service.o: ../../include/stringops.h
postconf_service.o: ../../include/sys_defs.h
postconf_service.o: ../../include/vbuf.h
postconf_service.o: ../../include/vstream.h
postconf_service.o: ../../include/vstring.h
postconf_service.o: postconf.h
postconf_service.o: postconf_service.c
postconf_unused.o: ../../include/argv.h
postconf_unused.o: ../../include/check_arg.h
postconf_unused.o: ../../include/dict.h
postconf_unused.o: ../../include/htable.h
postconf_unused.o: ../../include/mail_conf.h
postconf_unused.o: ../../include/mail_params.h
postconf_unused.o: ../../include/msg.h
postconf_unused.o: ../../include/myflock.h
postconf_unused.o: ../../include/name_code.h
postconf_unused.o: ../../include/sys_defs.h
postconf_unused.o: ../../include/vbuf.h
postconf_unused.o: ../../include/vstream.h
postconf_unused.o: ../../include/vstring.h
postconf_unused.o: postconf.h
postconf_unused.o: postconf_unused.c
postconf_user.o: ../../include/argv.h
postconf_user.o: ../../include/check_arg.h
postconf_user.o: ../../include/dict.h
postconf_user.o: ../../include/htable.h
postconf_user.o: ../../include/mac_expand.h
postconf_user.o: ../../include/mac_parse.h
postconf_user.o: ../../include/mail_conf.h
postconf_user.o: ../../include/mail_params.h
postconf_user.o: ../../include/msg.h
postconf_user.o: ../../include/myflock.h
postconf_user.o: ../../include/mymalloc.h
postconf_user.o: ../../include/name_code.h
postconf_user.o: ../../include/stringops.h
postconf_user.o: ../../include/sys_defs.h
postconf_user.o: ../../include/vbuf.h
postconf_user.o: ../../include/vstream.h
postconf_user.o: ../../include/vstring.h
postconf_user.o: postconf.h
postconf_user.o: postconf_user.c
