1102644Snectar/* 2233294Sstas * Copyright (c) 2002 Kungliga Tekniska H��gskolan 3102644Snectar * (Royal Institute of Technology, Stockholm, Sweden). 4102644Snectar * All rights reserved. 5233294Sstas * 6102644Snectar * Redistribution and use in source and binary forms, with or without 7102644Snectar * modification, are permitted provided that the following conditions 8102644Snectar * are met: 9233294Sstas * 10102644Snectar * 1. Redistributions of source code must retain the above copyright 11102644Snectar * notice, this list of conditions and the following disclaimer. 12233294Sstas * 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. 16233294Sstas * 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. 20233294Sstas * 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 34233294Sstas/* $Id$ */ 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 44233294Sstas#define ROKEN_LIB_FUNCTION 45233294Sstas#define ROKEN_LIB_CALL __cdecl 46178825Sdfr#else 47178825Sdfr#define ROKEN_LIB_FUNCTION 48233294Sstas#define ROKEN_LIB_CALL 49178825Sdfr#endif 50178825Sdfr#endif 51178825Sdfr 52102644Snectar#ifndef dbm_rename 53102644Snectar#define dbm_rename(X) __roken_ ## X 54102644Snectar#endif 55102644Snectar 56102644Snectar#define dbm_open dbm_rename(dbm_open) 57102644Snectar#define dbm_close dbm_rename(dbm_close) 58102644Snectar#define dbm_delete dbm_rename(dbm_delete) 59102644Snectar#define dbm_fetch dbm_rename(dbm_fetch) 60102644Snectar#define dbm_get dbm_rename(dbm_get) 61102644Snectar#define dbm_firstkey dbm_rename(dbm_firstkey) 62102644Snectar#define dbm_nextkey dbm_rename(dbm_nextkey) 63102644Snectar#define dbm_store dbm_rename(dbm_store) 64102644Snectar#define dbm_error dbm_rename(dbm_error) 65102644Snectar#define dbm_clearerr dbm_rename(dbm_clearerr) 66102644Snectar 67102644Snectar#define datum dbm_rename(datum) 68102644Snectar 69102644Snectartypedef struct { 70102644Snectar void *dptr; 71102644Snectar size_t dsize; 72102644Snectar} datum; 73102644Snectar 74102644Snectar#define DBM_REPLACE 1 75102644Snectartypedef struct DBM DBM; 76102644Snectar 77102644Snectar#if 0 78102644Snectartypedef struct { 79102644Snectar int dummy; 80102644Snectar} DBM; 81102644Snectar#endif 82102644Snectar 83233294SstasROKEN_LIB_FUNCTION int ROKEN_LIB_CALL dbm_clearerr (DBM*); 84233294SstasROKEN_LIB_FUNCTION void ROKEN_LIB_CALL dbm_close (DBM*); 85233294SstasROKEN_LIB_FUNCTION int ROKEN_LIB_CALL dbm_delete (DBM*, datum); 86233294SstasROKEN_LIB_FUNCTION int ROKEN_LIB_CALL dbm_error (DBM*); 87233294SstasROKEN_LIB_FUNCTION datum ROKEN_LIB_CALL dbm_fetch (DBM*, datum); 88233294SstasROKEN_LIB_FUNCTION datum ROKEN_LIB_CALL dbm_firstkey (DBM*); 89233294SstasROKEN_LIB_FUNCTION datum ROKEN_LIB_CALL dbm_nextkey (DBM*); 90233294SstasROKEN_LIB_FUNCTION DBM* ROKEN_LIB_CALL dbm_open (const char*, int, mode_t); 91233294SstasROKEN_LIB_FUNCTION int ROKEN_LIB_CALL dbm_store (DBM*, datum, datum, int); 92102644Snectar 93102644Snectar#endif /* __ndbm_wrap_h__ */ 94