(gdbm.info.gz) Compatibility
Info Catalog
(gdbm.info.gz) Variables
(gdbm.info.gz) Top
(gdbm.info.gz) Conversion
Compatibility with standard `dbm' and `ndbm'.
*********************************************
GNU `dbm' files are not `sparse'. You can copy them with the UNIX
`cp' command and they will not expand in the copying process.
There is a compatibility mode for use with programs that already use
UNIX `dbm' and UNIX `ndbm'.
GNU `dbm' has compatibility functions for `dbm'. For `dbm'
compatibility functions, you need the include file `dbm.h'.
In this compatibility mode, no `gdbm' file pointer is required by
the user, and Only one file may be opened at a time. All users in
compatibility mode are assumed to be writers. If the `gdbm' file is a
read only, it will fail as a writer, but will also try to open it as a
reader. All returned pointers in datum structures point to data that
`gdbm' WILL free. They should be treated as static pointers (as
standard UNIX `dbm' does). The compatibility function names are the
same as the UNIX `dbm' function names. Their definitions follow:
int dbminit(name);
int store(key, content);
datum fetch(key);
int delete(key);
datum firstkey();
datum nextkey(key);
int dbmclose();
Standard UNIX `dbm' and GNU `dbm' do not have the same data format
in the file. You cannot access a standard UNIX `dbm' file with GNU
`dbm'! If you want to use an old database with GNU `dbm', you must use
the `conv2gdbm' program.
Also, GNU `dbm' has compatibility functions for `ndbm'. For `ndbm'
compatibility functions, you need the include file `ndbm.h'.
Again, just like `ndbm', any returned datum can be assumed to be
static storage. You do not have to free that memory, the `ndbm'
compatibility functions will do it for you.
The functions are:
DBM *dbm_open(name, flags, mode);
void dbm_close(file);
datum dbm_fetch(file, key);
int dbm_store(file, key, `content', flags);
int dbm_delete(file, key);
datum dbm_firstkey(file);
datum dbm_nextkey(file);
int dbm_error(file);
int dbm_clearerr(file);
int dbm_dirfno(file);
int dbm_pagfno(file);
int dbm_rdonly(file);
If you want to compile an old C program that used UNIX `dbm' or
`ndbm' and want to use `gdbm' files, execute the following `cc' command:
cc ... -L/usr/local/lib -lgdbm -lgdbm_compat
Info Catalog
(gdbm.info.gz) Variables
(gdbm.info.gz) Top
(gdbm.info.gz) Conversion
automatically generated byinfo2html