11539Srgrimes/*- 21539Srgrimes * Copyright (c) 1990, 1993 31539Srgrimes * The Regents of the University of California. All rights reserved. 41539Srgrimes * 51539Srgrimes * This code is derived from software contributed to Berkeley by 61539Srgrimes * Margo Seltzer. 71539Srgrimes * 81539Srgrimes * Redistribution and use in source and binary forms, with or without 91539Srgrimes * modification, are permitted provided that the following conditions 101539Srgrimes * are met: 111539Srgrimes * 1. Redistributions of source code must retain the above copyright 121539Srgrimes * notice, this list of conditions and the following disclaimer. 131539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141539Srgrimes * notice, this list of conditions and the following disclaimer in the 151539Srgrimes * documentation and/or other materials provided with the distribution. 16203964Simp * 3. Neither the name of the University nor the names of its contributors 171539Srgrimes * may be used to endorse or promote products derived from this software 181539Srgrimes * without specific prior written permission. 191539Srgrimes * 201539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 211539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 221539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 231539Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 241539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 251539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 261539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 271539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 281539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 291539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 301539Srgrimes * SUCH DAMAGE. 311539Srgrimes * 321539Srgrimes * @(#)ndbm.h 8.1 (Berkeley) 6/2/93 3393032Simp * $FreeBSD$ 341539Srgrimes */ 351539Srgrimes 361539Srgrimes#ifndef _NDBM_H_ 371539Srgrimes#define _NDBM_H_ 381539Srgrimes 391539Srgrimes#include <db.h> 401539Srgrimes 411539Srgrimes/* Map dbm interface onto db(3). */ 421539Srgrimes#define DBM_RDONLY O_RDONLY 431539Srgrimes 441539Srgrimes/* Flags to dbm_store(). */ 451539Srgrimes#define DBM_INSERT 0 461539Srgrimes#define DBM_REPLACE 1 471539Srgrimes 481539Srgrimes/* 4914352Sjkh * The db(3) support for ndbm always appends this suffix to the 501539Srgrimes * file name to avoid overwriting the user's original database. 511539Srgrimes */ 521539Srgrimes#define DBM_SUFFIX ".db" 531539Srgrimes 541539Srgrimestypedef struct { 55300999Sed void *dptr; 561539Srgrimes int dsize; 571539Srgrimes} datum; 581539Srgrimes 591539Srgrimestypedef DB DBM; 601539Srgrimes#define dbm_pagfno(a) DBM_PAGFNO_NOT_AVAILABLE 611539Srgrimes 621539Srgrimes__BEGIN_DECLS 6393032Simpint dbm_clearerr(DBM *); 6493032Simpvoid dbm_close(DBM *); 6593032Simpint dbm_delete(DBM *, datum); 6693032Simpint dbm_error(DBM *); 6793032Simpdatum dbm_fetch(DBM *, datum); 6893032Simpdatum dbm_firstkey(DBM *); 69189808Sdas#if __BSD_VISIBLE 7093032Simplong dbm_forder(DBM *, datum); 71189808Sdas#endif 7293032Simpdatum dbm_nextkey(DBM *); 73301066SedDBM *dbm_open(const char *, int, mode_t); 7493032Simpint dbm_store(DBM *, datum, datum, int); 75189808Sdas#if __BSD_VISIBLE 7693032Simpint dbm_dirfno(DBM *); 77189808Sdas#endif 781539Srgrimes__END_DECLS 791539Srgrimes 801539Srgrimes#endif /* !_NDBM_H_ */ 81