#!/bin/sh -
#
# $Id: chk.def,v 1.5 2001/04/11 16:26:45 bostic Exp $
#
# Check to make sure we haven't forgotten to add any interfaces
# to the Win32 libdb.def file.

# Run from the top-level directory.
[ -f db_config.h ] && cd ..

f=build_win32/libdb.def
t1=/tmp/__1
t2=/tmp/__2

sed '/; /d' $f |
    egrep @ |
    awk '{print $1}' |
    sed -e '/db_xa_switch/d' \
	-e '/^__/d' -e '/^;/d' |
    sort > ${t1}

egrep __P include_auto/global_ext.in |
    sed '/^[a-z]/!d' |
    awk '{print $2}' |
    sed 's/^\*//' |
    sed '/^__/d' | sort > ${t2}

if cmp -s ${t1} ${t2} ; then
	:
else
	echo "<<< libdb.def >>> DB include files"
	diff ${t1} ${t2}
fi

# Check to make sure we don't have any extras in the libdb.def file.
sed '/; /d' $f |
    egrep @ |
    awk '{print $1}' |
    sed -e '/__db_global_values/d' > ${t1}

for i in `cat ${t1}`; do
	if egrep $i */*.c > /dev/null; then
		:
	else
		echo "$f: $i not found in DB sources"
	fi
done

rm -f ${t1} ${t2}
