43 int read_write= GDBM_READER;
54 read_write = GDBM_WRCREAT | GDBM_NOLOCK;
59 if (strcmp(
l->mode,
"rw")==0) mode=
"rw";
63 db = (GDBM_info *)
omAlloc0(
sizeof *db);
64 if((db->db = gdbm_open(
l->name, BLOCKSIZE, read_write, 0664, 0)) !=
NULL )
89 Print(
"%d/%s",gdbm_errno,gdbm_strerror(gdbm_errno));
96 GDBM_info *db = (GDBM_info *)
l->data;
109 GDBM_info *db = (GDBM_info *)
l->data;
135 d_value = gdbm_fetch(db->db, d_key);
143 WerrorS(
"read(`GDBM link`,`string`) expected");
151 d_key = gdbm_firstkey(db->db);
157 if (db->actual.dptr==
NULL)
159 db->actual=gdbm_firstkey(db->db);
161 d_key = gdbm_nextkey(db->db,db->actual);
173 d_value = gdbm_fetch(db->db, d_key);
200 GDBM_info *db = (GDBM_info *)
l->data;
207 if (strcmp(
l->mode,
"rw")!=0)
209 PrintS(
"Write error on readonly source\n");
235 ret = gdbm_store(db->db, d_key,
d_value, GDBM_REPLACE);
237 if (ret==-1) {
PrintS(
"reader calls gdbm_store!");}
245 Werror(
"GDBM link I/O error: '%s' ", gdbm_errno);
260 gdbm_delete(db->db, d_key);
266 WerrorS(
"write(`GDBM link`,`key string` [,`data string`]) expected");
284 const char *mode =
"r";
286 int dbm_flags = O_RDONLY | O_CREAT;
289 && ((
l->mode[0]==
'w')||(
l->mode[1]==
'w')))
291 dbm_flags = O_RDWR | O_CREAT;
310 l->data=(
void *)(db);
352 WerrorS(
"read(`DBM link`,`string`) expected");
409 Werror(
"DBM link I/O error. Is '%s' readonly?",
l->name);
427 WerrorS(
"write(`DBM link`,`key string` [,`data string`]) expected");
Class used for (list of) interpreter objects.
const Variable & v
< [in] a sqrfree bivariate poly
void WerrorS(const char *s)
if(!FE_OPT_NO_SHELL_FLAG)(void) system(sys)
EXTERN_VAR omBin sleftv_bin
int dbm_store(DBM *db, datum key, datum dat, int replace)
datum dbm_fetch(DBM *db, datum key)
int dbm_delete(DBM *db, datum key)
datum dbm_nextkey(DBM *db)
datum dbm_firstkey(DBM *db)
DBM * dbm_open(char *file, int flags, int mode)
#define omFreeSize(addr, size)
#define omFreeBinAddr(addr)
void PrintS(const char *s)
void Werror(const char *fmt,...)
#define SI_LINK_W_OPEN_P(l)
#define SI_LINK_SET_R_OPEN_P(l)
#define SI_LINK_SET_CLOSE_P(l)
#define SI_LINK_RW_OPEN_P(l)
#define SI_LINK_R_OPEN_P(l)
#define SI_LINK_SET_RW_OPEN_P(l)
#define SI_LINK_SET_W_OPEN_P(l)
#define SI_LINK_CLOSE_P(l)
LINKAGE BOOLEAN dbClose(si_link l)
LINKAGE BOOLEAN dbWrite(si_link l, leftv key)
LINKAGE leftv dbRead1(si_link l)
LINKAGE BOOLEAN dbOpen(si_link l, short flag, leftv)
LINKAGE leftv dbRead2(si_link l, leftv key)