ndbm.h revision 14352
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. 161539Srgrimes * 3. All advertising materials mentioning features or use of this software 171539Srgrimes * must display the following acknowledgement: 181539Srgrimes * This product includes software developed by the University of 191539Srgrimes * California, Berkeley and its contributors. 201539Srgrimes * 4. Neither the name of the University nor the names of its contributors 211539Srgrimes * may be used to endorse or promote products derived from this software 221539Srgrimes * without specific prior written permission. 231539Srgrimes * 241539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271539Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 291539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 301539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 331539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 341539Srgrimes * SUCH DAMAGE. 351539Srgrimes * 361539Srgrimes * @(#)ndbm.h 8.1 (Berkeley) 6/2/93 371539Srgrimes */ 381539Srgrimes 391539Srgrimes#ifndef _NDBM_H_ 401539Srgrimes#define _NDBM_H_ 411539Srgrimes 421539Srgrimes#include <db.h> 431539Srgrimes 441539Srgrimes/* Map dbm interface onto db(3). */ 451539Srgrimes#define DBM_RDONLY O_RDONLY 461539Srgrimes 471539Srgrimes/* Flags to dbm_store(). */ 481539Srgrimes#define DBM_INSERT 0 491539Srgrimes#define DBM_REPLACE 1 501539Srgrimes 511539Srgrimes/* 5214352Sjkh * The db(3) support for ndbm always appends this suffix to the 531539Srgrimes * file name to avoid overwriting the user's original database. 541539Srgrimes */ 551539Srgrimes#define DBM_SUFFIX ".db" 561539Srgrimes 571539Srgrimestypedef struct { 581539Srgrimes char *dptr; 591539Srgrimes int dsize; 601539Srgrimes} datum; 611539Srgrimes 621539Srgrimestypedef DB DBM; 631539Srgrimes#define dbm_pagfno(a) DBM_PAGFNO_NOT_AVAILABLE 641539Srgrimes 651539Srgrimes__BEGIN_DECLS 661539Srgrimesvoid dbm_close __P((DBM *)); 671539Srgrimesint dbm_delete __P((DBM *, datum)); 681539Srgrimesdatum dbm_fetch __P((DBM *, datum)); 691539Srgrimesdatum dbm_firstkey __P((DBM *)); 701539Srgrimeslong dbm_forder __P((DBM *, datum)); 711539Srgrimesdatum dbm_nextkey __P((DBM *)); 721539SrgrimesDBM *dbm_open __P((const char *, int, int)); 731539Srgrimesint dbm_store __P((DBM *, datum, datum, int)); 741539Srgrimesint dbm_dirfno __P((DBM *)); 751539Srgrimes__END_DECLS 761539Srgrimes 771539Srgrimes#endif /* !_NDBM_H_ */ 78