-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbif.h
54 lines (39 loc) · 1.06 KB
/
dbif.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef _DBIF_D
#define _DBIF_D
#include "config.h"
#include <errno.h>
#if USE_NDBM
# include <sys/types.h>
# include <sys/stat.h>
# include <fcntl.h>
# include <ndbm.h>
typedef DB_HANDLE DBhandle;
#define DBIF_READER O_RDONLY
#define DBIF_WRITER O_RDWR
#define DBIF_CREAT O_CREAT
#define DBIF_TRUNC O_TRUNC|O_CREAT
#define DBIF_REPLACE DBM_REPLACE
#define DBIF_INSERT DBM_INSERT
#define dbif_errno errno
#elif USE_GDBM
# include <gdbm.h>
typedef GDBM_FILE DBhandle;
#define DBIF_READER 0x00
#define DBIF_WRITER 0x01
#define DBIF_CREAT 0x10 /* "gdbm_wrcreat" */
#define DBIF_TRUNC 0x20 /* "gdbm_newdb" */
#define DBIF_REPLACE GDBM_REPLACE
#define DBIF_INSERT GDBM_INSERT
#define dbif_errno gdbm_errno
#else
# error "Can't build postoffice without ndbm"
#endif
DBhandle dbif_open(char*, int, int);
void dbif_close(DBhandle);
char* dbif_get(DBhandle, char*);
int dbif_put(DBhandle, char*, char*,int);
int dbif_delete(DBhandle, char*);
int dbif_rename(char*,char*);
char* dbif_findfirst(DBhandle);
char* dbif_findnext(DBhandle,char*);
#endif/*_DBIF_D*/