1#!/bin/sh -
2#
3# $Id: chk.def,v 12.4 2008/05/07 12:39:40 bschmeck Exp $
4#
5# Check to make sure we haven't forgotten to add any interfaces
6# to the Windows libdb.def file.
7
8d=../..
9
10# Test must be run from the top-level directory, not from a test directory.
11[ -f $d/LICENSE ] || {
12	echo 'FAIL: cannot find source distribution directory.'
13	exit 1
14}
15
16f=$d/build_windows/libdb.def
17t1=__1
18t2=__2
19
20exitv=0
21
22sed '/; /d' $f |
23    egrep @ |
24    awk '{print $1}' |
25    sed -e '/db_xa_switch/d' \
26	-e '/^__/d' \
27	-e '/^;/d' |
28    sort > $t1
29
30egrep __P $d/dbinc_auto/ext_prot.in |
31    sed '/^[a-z]/!d' |
32    awk '{print $2}' |
33    sed -e 's/^\*//' \
34	-e '/db_env_set_func_\(free\|malloc\|realloc\)/p' \
35	-e '/db_env_set_func_/d' |
36    sed '/^__/d' | sort > $t2
37
38if cmp -s $t1 $t2 ; then
39	:
40else
41	echo "<<< libdb.def >>> DB include files"
42	diff $t1 $t2
43	echo "FAIL: missing items in libdb.def file."
44	exitv=1
45fi
46
47# Check to make sure we don't have any extras in the libdb.def file.
48sed '/; /d' $f |
49    egrep @ |
50    awk '{print $1}' |
51    sed -e '/__db_global_values/d' |
52    sed -e '/__db_C*/d' > $t1
53
54for i in `cat $t1`; do
55	if egrep $i $d/*/*.c > /dev/null; then
56		:
57	else
58		echo "$f: $i not found in DB sources"
59	fi
60done > $t2
61
62test -s $t2 && {
63	cat $t2
64	echo "FAIL: found unnecessary items in libdb.def file."
65	exitv=1
66}
67
68exit $exitv
69