1102644Snectar/*
2102644Snectar * Copyright (c) 2002 Kungliga Tekniska H�gskolan
3102644Snectar * (Royal Institute of Technology, Stockholm, Sweden).
4102644Snectar * All rights reserved.
5102644Snectar *
6102644Snectar * Redistribution and use in source and binary forms, with or without
7102644Snectar * modification, are permitted provided that the following conditions
8102644Snectar * are met:
9102644Snectar *
10102644Snectar * 1. Redistributions of source code must retain the above copyright
11102644Snectar *    notice, this list of conditions and the following disclaimer.
12102644Snectar *
13102644Snectar * 2. Redistributions in binary form must reproduce the above copyright
14102644Snectar *    notice, this list of conditions and the following disclaimer in the
15102644Snectar *    documentation and/or other materials provided with the distribution.
16102644Snectar *
17102644Snectar * 3. Neither the name of the Institute nor the names of its contributors
18102644Snectar *    may be used to endorse or promote products derived from this software
19102644Snectar *    without specific prior written permission.
20102644Snectar *
21102644Snectar * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22102644Snectar * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23102644Snectar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24102644Snectar * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25102644Snectar * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26102644Snectar * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27102644Snectar * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28102644Snectar * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29102644Snectar * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30102644Snectar * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31102644Snectar * SUCH DAMAGE.
32102644Snectar */
33102644Snectar
34178825Sdfr/* $Id: ndbm_wrap.h 14773 2005-04-12 11:29:18Z lha $ */
35102644Snectar
36102644Snectar#ifndef __ndbm_wrap_h__
37102644Snectar#define __ndbm_wrap_h__
38102644Snectar
39102644Snectar#include <stdio.h>
40102644Snectar#include <sys/types.h>
41102644Snectar
42178825Sdfr#ifndef ROKEN_LIB_FUNCTION
43178825Sdfr#ifdef _WIN32
44178825Sdfr#define ROKEN_LIB_FUNCTION _stdcall
45178825Sdfr#else
46178825Sdfr#define ROKEN_LIB_FUNCTION
47178825Sdfr#endif
48178825Sdfr#endif
49178825Sdfr
50102644Snectar#ifndef dbm_rename
51102644Snectar#define dbm_rename(X)	__roken_ ## X
52102644Snectar#endif
53102644Snectar
54102644Snectar#define dbm_open	dbm_rename(dbm_open)
55102644Snectar#define dbm_close	dbm_rename(dbm_close)
56102644Snectar#define dbm_delete	dbm_rename(dbm_delete)
57102644Snectar#define dbm_fetch	dbm_rename(dbm_fetch)
58102644Snectar#define dbm_get		dbm_rename(dbm_get)
59102644Snectar#define dbm_firstkey	dbm_rename(dbm_firstkey)
60102644Snectar#define dbm_nextkey	dbm_rename(dbm_nextkey)
61102644Snectar#define dbm_store	dbm_rename(dbm_store)
62102644Snectar#define dbm_error	dbm_rename(dbm_error)
63102644Snectar#define dbm_clearerr	dbm_rename(dbm_clearerr)
64102644Snectar
65102644Snectar#define datum		dbm_rename(datum)
66102644Snectar
67102644Snectartypedef struct {
68102644Snectar    void *dptr;
69102644Snectar    size_t dsize;
70102644Snectar} datum;
71102644Snectar
72102644Snectar#define DBM_REPLACE 1
73102644Snectartypedef struct DBM DBM;
74102644Snectar
75102644Snectar#if 0
76102644Snectartypedef struct {
77102644Snectar    int dummy;
78102644Snectar} DBM;
79102644Snectar#endif
80102644Snectar
81178825Sdfrint ROKEN_LIB_FUNCTION dbm_clearerr (DBM*);
82178825Sdfrvoid ROKEN_LIB_FUNCTION dbm_close (DBM*);
83178825Sdfrint ROKEN_LIB_FUNCTION dbm_delete (DBM*, datum);
84178825Sdfrint ROKEN_LIB_FUNCTION dbm_error (DBM*);
85178825Sdfrdatum ROKEN_LIB_FUNCTION dbm_fetch (DBM*, datum);
86178825Sdfrdatum ROKEN_LIB_FUNCTION dbm_firstkey (DBM*);
87178825Sdfrdatum ROKEN_LIB_FUNCTION dbm_nextkey (DBM*);
88178825SdfrDBM* ROKEN_LIB_FUNCTION dbm_open (const char*, int, mode_t);
89178825Sdfrint ROKEN_LIB_FUNCTION dbm_store (DBM*, datum, datum, int);
90102644Snectar
91102644Snectar#endif /* __ndbm_wrap_h__ */
92