1#!/bin/sh -
2#
3# $Id: chk.method,v 12.7 2008/05/07 12:47:43 bschmeck Exp $
4#
5# Check that DB doesn't call DB or DB_ENV methods internally.
6
7d=../..
8
9t=__1
10
11echo ========================================================
12echo "Check that DB doesn't call DB or DB_ENV methods internally."
13echo ========================================================
14m=`grep '(\*[a-z][_a-z]*)' $d/dbinc/db.in |
15   sed -e 's/^[^(]*(\*//' \
16       -e 's/).*//' \
17       -e '/am_bulk/d' \
18       -e '/am_close/d' \
19       -e '/am_del/d' \
20       -e '/am_destroy/d' \
21       -e '/am_get/d' \
22       -e '/am_put/d' \
23       -e '/am_remove/d' \
24       -e '/am_rename/d' \
25       -e '/am_writelock/d' \
26       -e '/app_dispatch/d' \
27       -e '/db_append_recno/d' \
28       -e '/db_errcall/d' \
29       -e '/db_event_func/d' \
30       -e '/db_feedback/d' \
31       -e '/db_free/d' \
32       -e '/db_malloc/d' \
33       -e '/db_paniccall/d' \
34       -e '/db_realloc/d' \
35       -e '/dbt_usercopy/d' \
36       -e '/dup_compare/d' \
37       -e '/s_callback/d' |
38   sort -u`
39
40(cd $d && for i in $m; do
41	#echo "$i..." > /dev/stderr
42	egrep -- "->$i\(" */*.[ch]
43done) |
44sed \
45    -e '/Wrapper function for/d' \
46    -e '/\/db.h:/d' \
47    -e '/^[^:]*:[	 ]*\*[	 ]/d' \
48    -e '/^common\/db_getlong.c:/d' \
49    -e '/^common\/util_cache.c:/d' \
50    -e '/^common\/util_log.c:/d' \
51    -e '/^common\/util_sig.c:/d' \
52    -e '/^db185\//d' \
53    -e '/^db_archive\//d' \
54    -e '/^db_checkpoint\//d' \
55    -e '/^db_codegen\//d' \
56    -e '/^db_deadlock\//d' \
57    -e '/^db_dump185\//d' \
58    -e '/^db_dump\//d' \
59    -e '/^db_hotbackup\//d' \
60    -e '/^db_load\//d' \
61    -e '/^db_printlog\//d' \
62    -e '/^db_recover\//d' \
63    -e '/^db_stat\//d' \
64    -e '/^db_upgrade\//d' \
65    -e '/^db_verify\//d' \
66    -e '/^dbm\//d' \
67    -e '/^examples_c\//d' \
68    -e '/^examples_cxx\//d' \
69    -e '/^examples_java\//d' \
70    -e '/^hsearch\//d' \
71    -e '/^libdb_java\//d' \
72    -e '/^mod_db4\//d' \
73    -e '/^mutex\/tm.c:/d' \
74    -e '/^php_db4\//d' \
75    -e '/^tcl\//d' \
76    -e '/^test\//d' \
77    -e '/^test_erlang\//d' \
78    -e '/^test_perf\//d' \
79    -e '/^test_purify\//d' \
80    -e '/^test_rep\//d' \
81    -e '/^test_server\//d' \
82    -e '/^test_thread\//d' \
83    -e '/^test_vxworks\//d' \
84    -e '/^xa\//d' \
85    -e '/closeme->close() is a wrapper;/d' \
86    -e '/crypto.c.*db_cipher->close/d' \
87    -e '/db_err.c:.*dbenv->db_msgcall(dbenv, buf);/d' \
88    -e '/db_iface.c:.*(txn->commit(txn, nosync ? DB_TXN_NOSYNC : 0));/d' \
89    -e '/db_iface.c:.*if ((t_ret = txn->abort(txn)) != 0)/d' \
90    -e '/db_iface.c:.*return (dbenv->txn_begin(dbenv, NULL, txnidp, 0));/d' \
91    -e '/db_iface.c:.*return (dbp->get(dbp, txn, key, &data, flags));/d' \
92    -e '/dbenv->is_alive(/d' \
93    -e '/dbenv->thread_id(/d' \
94    -e '/dbenv->thread_id_string(/d' \
95    -e '/rep_util.c:.*ret = dbenv->rep_send(/d' \
96    -e '/test_mutex.c:/d'
97>$t
98
99test -s $t && {
100        cat $t
101	echo "FAIL: found DB/DB_ENV method calls DB library."
102	exit 1
103}
104
105exit 0
106