133965Sjdp/* GNU DBM - DataBase Manager include file 233965Sjdp Copyright 1989, 1991 Free Software Foundation, Inc. 333965Sjdp Written by Philip A. Nelson. 433965Sjdp 533965SjdpThis program is free software; you can redistribute it and/or modify 633965Sjdpit under the terms of the GNU General Public License as published by 733965Sjdpthe Free Software Foundation; either version 2 of the License, or 833965Sjdp(at your option) any later version. 933965Sjdp 1033965SjdpThis program is distributed in the hope that it will be useful, 1133965Sjdpbut WITHOUT ANY WARRANTY; without even the implied warranty of 1233965SjdpMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1333965SjdpGNU General Public License for more details. 1433965Sjdp 1533965SjdpYou should have received a copy of the GNU General Public License 1633965Sjdpalong with this program; if not, write to the Free Software 17218822SdimFoundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 1833965Sjdp 1933965Sjdp/* You may contact the author by: 2033965Sjdp e-mail: phil@wwu.edu 2133965Sjdp us-mail: Philip A. Nelson 2233965Sjdp Computer Science Department 2333965Sjdp Western Washington University 2433965Sjdp Bellingham, WA 98226 2533965Sjdp phone: (206) 676-3035 2633965Sjdp 2733965Sjdp*************************************************************************/ 2833965Sjdp 2933965Sjdp/* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who 3033965Sjdp can create the database. */ 3133965Sjdp#define GDBM_READER 0 3233965Sjdp#define GDBM_WRITER 1 3333965Sjdp#define GDBM_WRCREAT 2 3433965Sjdp#define GDBM_NEWDB 3 3533965Sjdp 3633965Sjdp/* Parameters to gdbm_store for simple insertion or replacement. */ 3733965Sjdp#define GDBM_INSERT 0 3833965Sjdp#define GDBM_REPLACE 1 3933965Sjdp 4033965Sjdp 4133965Sjdp/* The data and key structure. This structure is defined for compatibility. */ 4233965Sjdptypedef struct { 4333965Sjdp char *dptr; 4433965Sjdp int dsize; 4533965Sjdp } datum; 4633965Sjdp 4733965Sjdp 4833965Sjdp/* The file information header. This is good enough for most applications. */ 4933965Sjdptypedef struct {int dummy[10];} *GDBM_FILE; 5033965Sjdp 5133965Sjdp 5233965Sjdp/* These are the routines! */ 5333965Sjdp 5433965Sjdpextern GDBM_FILE gdbm_open (); 5533965Sjdp 5633965Sjdpextern void gdbm_close (); 5733965Sjdp 5833965Sjdpextern datum gdbm_fetch (); 5933965Sjdp 6033965Sjdpextern int gdbm_store (); 6133965Sjdp 6233965Sjdpextern int gdbm_delete (); 6333965Sjdp 6433965Sjdpextern datum gdbm_firstkey (); 6533965Sjdp 6633965Sjdpextern datum gdbm_nextkey (); 6733965Sjdp 6833965Sjdpextern int gdbm_reorganize (); 6933965Sjdp 7033965Sjdp 7133965Sjdp/* gdbm sends back the following error codes in the variable gdbm_errno. */ 7233965Sjdptypedef enum { NO_ERROR, 7333965Sjdp MALLOC_ERROR, 7433965Sjdp BLOCK_SIZE_ERROR, 7533965Sjdp FILE_OPEN_ERROR, 7633965Sjdp FILE_WRITE_ERROR, 7733965Sjdp FILE_SEEK_ERROR, 7833965Sjdp FILE_READ_ERROR, 7933965Sjdp BAD_MAGIC_NUMBER, 8033965Sjdp EMPTY_DATABASE, 8133965Sjdp CANT_BE_READER, 8233965Sjdp CANT_BE_WRITER, 8333965Sjdp READER_CANT_RECOVER, 8433965Sjdp READER_CANT_DELETE, 8533965Sjdp READER_CANT_STORE, 8633965Sjdp READER_CANT_REORGANIZE, 8733965Sjdp UNKNOWN_UPDATE, 8833965Sjdp ITEM_NOT_FOUND, 8933965Sjdp REORGANIZE_FAILED, 9033965Sjdp CANNOT_REPLACE} 9133965Sjdp gdbm_error; 92