diff src/database.c @ 4824:c12b646d84ee

changes to get things to compile under latest cygwin
author Ben Wing <ben@xemacs.org>
date Thu, 24 Dec 2009 19:45:23 -0600
parents 0e1461b592ce
children 493e2aa349fd d877c14318b3
line wrap: on
line diff
--- a/src/database.c	Mon Dec 21 13:51:39 2009 -0700
+++ b/src/database.c	Thu Dec 24 19:45:23 2009 -0600
@@ -85,7 +85,47 @@
 #endif /* HAVE_BERKELEY_DB */
 
 #ifdef HAVE_DBM
+#if defined (CYGWIN) || defined (MINGW)
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* As of Cygwin 1.7.0, the prototypes in ndbm.h are broken when compiling
+using C++, since they are of the form `datum dbm_firstkey()', without any
+args given. */
+/* Parameters to dbm_store for simple insertion or replacement. */
+#define  DBM_INSERT  0
+#define  DBM_REPLACE 1
+
+
+/* The data and key structure.  This structure is defined for compatibility. */
+typedef struct {
+        char *dptr;
+        int   dsize;
+      } datum;
+
+
+/* The file information header. This is good enough for most applications. */
+typedef struct {int dummy[10];} DBM;
+
+int     dbm_clearerr(DBM *);
+void    dbm_close(DBM *);
+int     dbm_delete(DBM *, datum);
+int     dbm_error(DBM *);
+datum   dbm_fetch(DBM *, datum);
+datum   dbm_firstkey(DBM *);
+datum   dbm_nextkey(DBM *);
+DBM    *dbm_open(const char *, int, mode_t);
+int     dbm_store(DBM *, datum, datum, int);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#else
 #include NDBM_H_FILE
+#endif
 Lisp_Object Qdbm;
 #endif /* HAVE_DBM */