source: trunk/third/perl/ext/SDBM_File/SDBM_File.xs @ 10724

Revision 10724, 1.2 KB checked in by ghudson, 27 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r10723, which included commits to RCS files with non-trunk default branches.
Line 
1#include "EXTERN.h"
2#include "perl.h"
3#include "XSUB.h"
4#include "sdbm/sdbm.h"
5
6typedef DBM* SDBM_File;
7#define sdbm_TIEHASH(dbtype,filename,flags,mode) sdbm_open(filename,flags,mode)
8#define sdbm_FETCH(db,key)                      sdbm_fetch(db,key)
9#define sdbm_STORE(db,key,value,flags)          sdbm_store(db,key,value,flags)
10#define sdbm_DELETE(db,key)                     sdbm_delete(db,key)
11#define sdbm_FIRSTKEY(db)                       sdbm_firstkey(db)
12#define sdbm_NEXTKEY(db,key)                    sdbm_nextkey(db)
13
14
15MODULE = SDBM_File      PACKAGE = SDBM_File     PREFIX = sdbm_
16
17SDBM_File
18sdbm_TIEHASH(dbtype, filename, flags, mode)
19        char *          dbtype
20        char *          filename
21        int             flags
22        int             mode
23
24void
25sdbm_DESTROY(db)
26        SDBM_File       db
27        CODE:
28        sdbm_close(db);
29
30datum
31sdbm_FETCH(db, key)
32        SDBM_File       db
33        datum           key
34
35int
36sdbm_STORE(db, key, value, flags = DBM_REPLACE)
37        SDBM_File       db
38        datum           key
39        datum           value
40        int             flags
41    CLEANUP:
42        if (RETVAL) {
43            if (RETVAL < 0 && errno == EPERM)
44                croak("No write permission to sdbm file");
45            croak("sdbm store returned %d, errno %d, key \"%s\"",
46                        RETVAL,errno,key.dptr);
47            sdbm_clearerr(db);
48        }
49
50int
51sdbm_DELETE(db, key)
52        SDBM_File       db
53        datum           key
54
55datum
56sdbm_FIRSTKEY(db)
57        SDBM_File       db
58
59datum
60sdbm_NEXTKEY(db, key)
61        SDBM_File       db
62        datum           key
63
64int
65sdbm_error(db)
66        SDBM_File       db
67
68int
69sdbm_clearerr(db)
70        SDBM_File       db
71
Note: See TracBrowser for help on using the repository browser.