ndbm.h revision 93032
1180740Sdes/*- 2180740Sdes * Copyright (c) 1990, 1993 3180740Sdes * The Regents of the University of California. All rights reserved. 4218767Sdes * 5180740Sdes * This code is derived from software contributed to Berkeley by 6180740Sdes * Margo Seltzer. 7239844Sdes * 8204861Sdes * Redistribution and use in source and binary forms, with or without 9204861Sdes * modification, are permitted provided that the following conditions 10180740Sdes * are met: 11180740Sdes * 1. Redistributions of source code must retain the above copyright 12218767Sdes * notice, this list of conditions and the following disclaimer. 13180740Sdes * 2. Redistributions in binary form must reproduce the above copyright 14262566Sdes * notice, this list of conditions and the following disclaimer in the 15262566Sdes * documentation and/or other materials provided with the distribution. 16262566Sdes * 3. All advertising materials mentioning features or use of this software 17262566Sdes * must display the following acknowledgement: 18262566Sdes * This product includes software developed by the University of 19180740Sdes * California, Berkeley and its contributors. 20204861Sdes * 4. Neither the name of the University nor the names of its contributors 21204861Sdes * may be used to endorse or promote products derived from this software 22204861Sdes * without specific prior written permission. 23204861Sdes * 24214979Sdes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25214979Sdes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26214979Sdes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27180740Sdes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28180740Sdes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29180740Sdes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30180740Sdes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31180740Sdes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32214979Sdes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33214979Sdes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34214979Sdes * SUCH DAMAGE. 35180740Sdes * 36180740Sdes * @(#)ndbm.h 8.1 (Berkeley) 6/2/93 37180740Sdes * $FreeBSD: head/include/ndbm.h 93032 2002-03-23 17:24:55Z imp $ 38180744Sdes */ 39214979Sdes 40248613Sdes#ifndef _NDBM_H_ 41248613Sdes#define _NDBM_H_ 42248613Sdes 43248613Sdes#include <db.h> 44248613Sdes 45180740Sdes/* Map dbm interface onto db(3). */ 46204861Sdes#define DBM_RDONLY O_RDONLY 47204861Sdes 48180740Sdes/* Flags to dbm_store(). */ 49248613Sdes#define DBM_INSERT 0 50248613Sdes#define DBM_REPLACE 1 51239844Sdes 52214979Sdes/* 53214979Sdes * The db(3) support for ndbm always appends this suffix to the 54180740Sdes * file name to avoid overwriting the user's original database. 55180740Sdes */ 56180740Sdes#define DBM_SUFFIX ".db" 57180740Sdes 58204861Sdestypedef struct { 59204861Sdes char *dptr; 60180740Sdes int dsize; 61180740Sdes} datum; 62180740Sdes 63214979Sdestypedef DB DBM; 64214979Sdes#define dbm_pagfno(a) DBM_PAGFNO_NOT_AVAILABLE 65180740Sdes 66180740Sdes__BEGIN_DECLS 67180740Sdesint dbm_clearerr(DBM *); 68180740Sdesvoid dbm_close(DBM *); 69180740Sdesint dbm_delete(DBM *, datum); 70180740Sdesint dbm_error(DBM *); 71180740Sdesdatum dbm_fetch(DBM *, datum); 72180740Sdesdatum dbm_firstkey(DBM *); 73180740Sdeslong dbm_forder(DBM *, datum); 74180740Sdesdatum dbm_nextkey(DBM *); 75180740SdesDBM *dbm_open(const char *, int, int); 76180740Sdesint dbm_store(DBM *, datum, datum, int); 77180740Sdesint dbm_dirfno(DBM *); 78180740Sdes__END_DECLS 79180740Sdes 80180740Sdes#endif /* !_NDBM_H_ */ 81180740Sdes