File: yp_db.h

package info (click to toggle)
ypserv 4.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,184 kB
  • sloc: ansic: 10,161; xml: 1,872; sh: 915; makefile: 263; awk: 21
file content (64 lines) | stat: -rw-r--r-- 1,381 bytes parent folder | download | duplicates (4)
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
55
56
57
58
59
60
61
62
63
64
#ifndef __YP_DB_H__
#define __YP_DB_H__

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "yp.h"

#define F_ALL   0x01
#define F_NEXT  0x02

#if defined(HAVE_COMPAT_LIBGDBM)
#if defined(HAVE_LIBGDBM)
#include <gdbm.h>
#elif defined(HAVE_LIBQDBM)
#include <hovel.h>
#endif

#define DB_FILE GDBM_FILE
#define ypdb_fetch(a,b)  gdbm_fetch(a,b)
#define ypdb_exists(a,b)  gdbm_exists(a,b)
#define ypdb_free(a) free(a)
#define ypdb_firstkey(a) gdbm_firstkey(a)
#define ypdb_nextkey(a,b) gdbm_nextkey(a,b)

#elif defined(HAVE_NDBM)

#include <ndbm.h>

#define DB_FILE DBM*
#define ypdb_fetch(a,b)  dbm_fetch(a,b)
#define ypdb_free(a)

extern int ypdb_exists (DB_FILE file, datum key);
/* extern datum ypdb_firstkey (DB_FILE file); */
#define ypdb_firstkey(a) dbm_firstkey(a)
extern datum ypdb_nextkey (DB_FILE file, datum key);
extern datum ypdb_fetch (DB_FILE file, datum key);

#elif defined(HAVE_LIBTC)

#include <tcbdb.h>

#define DB_FILE TCBDB *

#define ypdb_free(a) free(a)

extern int ypdb_exists (DB_FILE file, datum key);
extern datum ypdb_firstkey (DB_FILE file);
extern datum ypdb_nextkey (DB_FILE file, datum key);
extern datum ypdb_fetch (DB_FILE bdb, datum key);

#else

#error "No database found or selected !"

#endif

extern DB_FILE ypdb_open (const char *domain, const char *map);
extern int ypdb_close_all (void);
extern int ypdb_close (DB_FILE file);

#endif