PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/cvs/src/myndbm.h

https://bitbucket.org/freebsd/freebsd-head/
C++ Header | 59 lines | 29 code | 9 blank | 21 comment | 0 complexity | fbe370d61ad514cd3ac3cf0178c16420 MD5 | raw file
 1/*
 2 * Copyright (C) 1994-2005 The Free Software Foundation, Inc.
 3 *
 4 * This program is free software; you can redistribute it and/or modify
 5 * it under the terms of the GNU General Public License as published by
 6 * the Free Software Foundation; either version 2, or (at your option)
 7 * any later version.
 8 *
 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 */
14
15#ifdef MY_NDBM
16
17#define	DBLKSIZ	4096
18
19typedef struct
20{
21    List *dbm_list;			/* cached database */
22    Node *dbm_next;			/* next key to return for nextkey() */
23
24    /* Name of the file to write to if modified is set.  malloc'd.  */
25    char *name;
26
27    /* Nonzero if the database has been modified and dbm_close needs to
28       write it out to disk.  */
29    int modified;
30} DBM;
31
32typedef struct
33{
34    char *dptr;
35    int dsize;
36} datum;
37
38/*
39 * So as not to conflict with other dbm_open, etc., routines that may
40 * be included by someone's libc, all of my emulation routines are prefixed
41 * by "my" and we define the "standard" ones to be "my" ones here.
42 */
43#define	dbm_open	mydbm_open
44#define	dbm_close	mydbm_close
45#define	dbm_fetch	mydbm_fetch
46#define	dbm_firstkey	mydbm_firstkey
47#define	dbm_nextkey	mydbm_nextkey
48#define dbm_store	mydbm_store
49#define  DBM_INSERT  0
50#define  DBM_REPLACE 1
51
52DBM *mydbm_open PROTO((char *file, int flags, int mode));
53void mydbm_close PROTO((DBM * db));
54datum mydbm_fetch PROTO((DBM * db, datum key));
55datum mydbm_firstkey PROTO((DBM * db));
56datum mydbm_nextkey PROTO((DBM * db));
57extern int mydbm_store PROTO ((DBM *, datum, datum, int));
58
59#endif				/* MY_NDBM */