ndbm.h revision 189808
1251875Speter/*- 2251875Speter * Copyright (c) 1990, 1993 3251875Speter * The Regents of the University of California. All rights reserved. 4251875Speter * 5251875Speter * This code is derived from software contributed to Berkeley by 6251875Speter * Margo Seltzer. 7251875Speter * 8251875Speter * Redistribution and use in source and binary forms, with or without 9251875Speter * modification, are permitted provided that the following conditions 10251875Speter * are met: 11251875Speter * 1. Redistributions of source code must retain the above copyright 12251875Speter * notice, this list of conditions and the following disclaimer. 13251875Speter * 2. Redistributions in binary form must reproduce the above copyright 14251875Speter * notice, this list of conditions and the following disclaimer in the 15251875Speter * documentation and/or other materials provided with the distribution. 16251875Speter * 3. All advertising materials mentioning features or use of this software 17251875Speter * must display the following acknowledgement: 18251875Speter * This product includes software developed by the University of 19251875Speter * California, Berkeley and its contributors. 20251875Speter * 4. Neither the name of the University nor the names of its contributors 21251875Speter * may be used to endorse or promote products derived from this software 22251875Speter * without specific prior written permission. 23251875Speter * 24251875Speter * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25251875Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26251875Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27251875Speter * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28251875Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29251875Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30251875Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31251875Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32251875Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33251875Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34251875Speter * SUCH DAMAGE. 35251875Speter * 36251875Speter * @(#)ndbm.h 8.1 (Berkeley) 6/2/93 37251875Speter * $FreeBSD: head/include/ndbm.h 189808 2009-03-14 19:02:28Z das $ 38251875Speter */ 39251875Speter 40251875Speter#ifndef _NDBM_H_ 41251875Speter#define _NDBM_H_ 42251875Speter 43251875Speter#include <db.h> 44251875Speter 45251875Speter/* Map dbm interface onto db(3). */ 46251875Speter#define DBM_RDONLY O_RDONLY 47251875Speter 48251875Speter/* Flags to dbm_store(). */ 49251875Speter#define DBM_INSERT 0 50251875Speter#define DBM_REPLACE 1 51251875Speter 52251875Speter/* 53251875Speter * The db(3) support for ndbm always appends this suffix to the 54251875Speter * file name to avoid overwriting the user's original database. 55251875Speter */ 56251875Speter#define DBM_SUFFIX ".db" 57251875Speter 58251875Spetertypedef struct { 59251875Speter char *dptr; 60251875Speter int dsize; 61251875Speter} datum; 62251875Speter 63251875Spetertypedef DB DBM; 64251875Speter#define dbm_pagfno(a) DBM_PAGFNO_NOT_AVAILABLE 65251875Speter 66251875Speter__BEGIN_DECLS 67251875Speterint dbm_clearerr(DBM *); 68251875Spetervoid dbm_close(DBM *); 69251875Speterint dbm_delete(DBM *, datum); 70251875Speterint dbm_error(DBM *); 71251875Speterdatum dbm_fetch(DBM *, datum); 72251875Speterdatum dbm_firstkey(DBM *); 73251875Speter#if __BSD_VISIBLE 74251875Speterlong dbm_forder(DBM *, datum); 75251875Speter#endif 76251875Speterdatum dbm_nextkey(DBM *); 77251875SpeterDBM *dbm_open(const char *, int, int); 78251875Speterint dbm_store(DBM *, datum, datum, int); 79251875Speter#if __BSD_VISIBLE 80251875Speterint dbm_dirfno(DBM *); 81251875Speter#endif 82251875Speter__END_DECLS 83251875Speter 84251875Speter#endif /* !_NDBM_H_ */ 85251875Speter