From b8d5b0d052ebb2599d45540980c2f92fe38f08d3 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Tue, 25 Jul 1995 18:42:08 +0000 Subject: [PATCH] * kdb_dbm.c, t_kdb.c: Add prototype for dbm_error and dbm_clearerr in case they're not prototyped in the header files. * configure.in: Add test for missing prototypes for dbm_error and dbm_clearerr. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6322 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kdb/ChangeLog | 8 ++++++++ src/lib/kdb/configure.in | 34 ++++++++++++++++++++++++++++++++++ src/lib/kdb/kdb_dbm.c | 12 ++++++++++++ src/lib/kdb/t_kdb.c | 12 ++++++++++++ 4 files changed, 66 insertions(+) diff --git a/src/lib/kdb/ChangeLog b/src/lib/kdb/ChangeLog index 289c2d94f..fcebad85d 100644 --- a/src/lib/kdb/ChangeLog +++ b/src/lib/kdb/ChangeLog @@ -1,3 +1,11 @@ +Tue Jul 25 14:06:50 1995 Tom Yu + + * kdb_dbm.c, t_kdb.c: Add prototype for dbm_error and dbm_clearerr + in case they're not prototyped in the header files. + + * configure.in: Add test for missing prototypes for dbm_error and + dbm_clearerr. + Thu Jul 20 23:59:18 1995 Mark Eichin * kdb_dbm.c (krb5_dbm_db_create): move dirname, pagname diff --git a/src/lib/kdb/configure.in b/src/lib/kdb/configure.in index fce913aa1..4b45a6a1e 100644 --- a/src/lib/kdb/configure.in +++ b/src/lib/kdb/configure.in @@ -18,6 +18,40 @@ else DBFLAGS=-DBERK_DB_DBM fi AC_SUBST(DBFLAGS)dnl +AC_CHECK_LIB(ndbm,main) +AC_CHECK_LIB(dbm,main) +AC_MSG_CHECKING([for missing dbm_error prototype]) +if test "$ac_cv_func_dbm_open" = yes; then + AC_EGREP_HEADER([dbm_error], [ndbm.h], + AC_MSG_RESULT(no), AC_TRY_LINK( +[#include +int dbm_error();], +[dbm_error();], AC_DEFINE([MISSING_ERROR_PROTO]) +AC_MSG_RESULT(yes), AC_MSG_RESULT(no))) +else + AC_EGREP_HEADER([dbm_error], [ndbm.h], + AC_MSG_RESULT(no), AC_TRY_LINK( +[#include +int dbm_error();], +[dbm_error();], AC_DEFINE([MISSING_ERROR_PROTO]) +AC_MSG_RESULT(yes), AC_MSG_RESULT(no))) +fi +AC_MSG_CHECKING([for missing dbm_clearerr prototype]) +if test "$ac_cv_func_dbm_open" = yes; then + AC_EGREP_HEADER([dbm_error], [ndbm.h], + AC_MSG_RESULT(no), AC_TRY_LINK( +[#include +int dbm_clearerr();], +[dbm_clearerr();], AC_DEFINE([MISSING_CLEARERR_PROTO]) +AC_MSG_RESULT(yes), AC_MSG_RESULT(no))) +else + AC_EGREP_HEADER([dbm_error], [ndbm.h], + AC_MSG_RESULT(no), AC_TRY_LINK( +[#include +int dbm_clearerr();], +[dbm_clearerr();], AC_DEFINE([MISSING_CLEARERR_PROTO]) +AC_MSG_RESULT(yes), AC_MSG_RESULT(no))) +fi dnl V5_USE_SHARED_LIB AC_CHECK_FUNCS(srand48 srand srandom umask) diff --git a/src/lib/kdb/kdb_dbm.c b/src/lib/kdb/kdb_dbm.c index 4357c54cc..88ebb55b0 100644 --- a/src/lib/kdb/kdb_dbm.c +++ b/src/lib/kdb/kdb_dbm.c @@ -155,6 +155,18 @@ static kdb5_dispatch_table kdb5_default_dispatch = { (int (*)()) NULL /* Get DB data FD num */ }; #else /* BERK_DB_DBM */ +/* + * The following prototypes are necessary in case dbm_error and + * dbm_clearerr are in the library but not prototyped + * (e.g. NetBSD-1.0) + */ +#ifdef MISSING_ERROR_PROTO +int dbm_error PROTOTYPE((DBM *)); +#endif +#ifdef MISSING_CLEARERR_PROTO +int dbm_clearerr PROTOTYPE((DBM *)); +#endif + /* * This module contains all of the code which directly interfaces to * the underlying representation of the Kerberos database; this diff --git a/src/lib/kdb/t_kdb.c b/src/lib/kdb/t_kdb.c index ae43bab82..1010b65dd 100644 --- a/src/lib/kdb/t_kdb.c +++ b/src/lib/kdb/t_kdb.c @@ -106,6 +106,18 @@ static kdb5_dispatch_table berkeley_dispatch = { (int (*)()) NULL /* Get Database FD num */ }; +/* + * The following prototypes are necessary in case dbm_error and + * dbm_clearerr are in the library but not prototyped + * (e.g. NetBSD-1.0) + */ +#ifdef MISSING_ERROR_PROTO +int dbm_error PROTOTYPE((DBM *)); +#endif +#ifdef MISSING_CLEARERR_PROTO +int dbm_clearerr PROTOTYPE((DBM *)); +#endif + static kdb5_dispatch_table dbm_dispatch = { "Stock [N]DBM Database", ".dir", /* Index file name ext */ -- 2.26.2