ndbm.h revision 1539
1139804Simp/*- 21541Srgrimes * Copyright (c) 1990, 1993 31541Srgrimes * The Regents of the University of California. All rights reserved. 41541Srgrimes * 51541Srgrimes * This code is derived from software contributed to Berkeley by 61541Srgrimes * Margo Seltzer. 71541Srgrimes * 81541Srgrimes * Redistribution and use in source and binary forms, with or without 91541Srgrimes * modification, are permitted provided that the following conditions 101541Srgrimes * are met: 111541Srgrimes * 1. Redistributions of source code must retain the above copyright 121541Srgrimes * notice, this list of conditions and the following disclaimer. 131541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141541Srgrimes * notice, this list of conditions and the following disclaimer in the 151541Srgrimes * documentation and/or other materials provided with the distribution. 161541Srgrimes * 3. All advertising materials mentioning features or use of this software 171541Srgrimes * must display the following acknowledgement: 181541Srgrimes * This product includes software developed by the University of 191541Srgrimes * California, Berkeley and its contributors. 201541Srgrimes * 4. Neither the name of the University nor the names of its contributors 211541Srgrimes * may be used to endorse or promote products derived from this software 221541Srgrimes * without specific prior written permission. 231541Srgrimes * 241541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 291541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 301541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 331541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 341541Srgrimes * SUCH DAMAGE. 351541Srgrimes * 36116182Sobrien * @(#)ndbm.h 8.1 (Berkeley) 6/2/93 37116182Sobrien */ 38116182Sobrien 391541Srgrimes#ifndef _NDBM_H_ 401541Srgrimes#define _NDBM_H_ 4112577Sbde 421541Srgrimes#include <db.h> 431541Srgrimes 4424206Sbde/* Map dbm interface onto db(3). */ 4524206Sbde#define DBM_RDONLY O_RDONLY 461541Srgrimes 473308Sphk/* Flags to dbm_store(). */ 4812517Sjulian#define DBM_INSERT 0 4929357Speter#define DBM_REPLACE 1 5041086Struckman 5170069Sjhb/* 5212517Sjulian * The db(3) support for ndbm(3) always appends this suffix to the 531541Srgrimes * file name to avoid overwriting the user's original database. 541541Srgrimes */ 551541Srgrimes#define DBM_SUFFIX ".db" 561541Srgrimes 571541Srgrimestypedef struct { 5812675Sjulian char *dptr; 5912675Sjulian int dsize; 6012675Sjulian} datum; 6112675Sjulian 6229357Spetertypedef DB DBM; 6312675Sjulian#define dbm_pagfno(a) DBM_PAGFNO_NOT_AVAILABLE 6470069Sjhb 6570069Sjhb__BEGIN_DECLS 6612675Sjulianvoid dbm_close __P((DBM *)); 6747625Sphkint dbm_delete __P((DBM *, datum)); 68126080Sphkdatum dbm_fetch __P((DBM *, datum)); 69126080Sphkdatum dbm_firstkey __P((DBM *)); 70111815Sphklong dbm_forder __P((DBM *, datum)); 71111815Sphkdatum dbm_nextkey __P((DBM *)); 72111815SphkDBM *dbm_open __P((const char *, int, int)); 73111815Sphkint dbm_store __P((DBM *, datum, datum, int)); 74111815Sphkint dbm_dirfno __P((DBM *)); 75111815Sphk__END_DECLS 76111815Sphk 7747625Sphk#endif /* !_NDBM_H_ */ 7812675Sjulian