#ifndef _NDBM_H_
#define _NDBM_H_
-#include <sys/cdefs.h>
#include <_types.h>
+#include <sys/_types/_mode_t.h>
+#include <sys/_types/_size_t.h>
-#ifndef _MODE_T
-typedef __darwin_mode_t mode_t;
-#define _MODE_T
-#endif
-
-#ifndef _SIZE_T
-#define _SIZE_T
-typedef __darwin_size_t size_t;
-#endif
-
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE)
+#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
/* Map dbm interface onto db(3). */
#include <fcntl.h>
#define DBM_RDONLY O_RDONLY
#define DBM_INSERT 0
#define DBM_REPLACE 1
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE)
+#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
/*
* The db(3) support for ndbm(3) always appends this suffix to the
* file name to avoid overwriting the user's original database.
size_t dsize;
} datum;
-typedef struct __db DBM;
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE)
+#ifndef _DBM
+#define _DBM
+typedef struct {
+ char __opaque[sizeof(int) + 8 * sizeof(void *)];
+} DBM;
+#endif /* _DBM */
+
+#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
#define dbm_pagfno(a) DBM_PAGFNO_NOT_AVAILABLE
#endif
int dbm_clearerr( DBM *);
void dbm_close(DBM *);
int dbm_delete(DBM *, datum);
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE)
+#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
int dbm_dirfno(DBM *);
#endif
int dbm_error( DBM *);
datum dbm_fetch(DBM *, datum);
datum dbm_firstkey(DBM *);
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE)
+#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
long dbm_forder(DBM *, datum);
#endif
datum dbm_nextkey(DBM *);