Open System Services Library Calls Reference Manual (G06.27+, H06.04+)

OSS Library Calls (a - d) dbm_clearerr(3)
If the db parameter does not point to a database structure, the results are undened and [EIN-
VAL] is returned.
CAUTIONS
The dptr pointer returned by some of these functions may point to static storage that may be
overwritten by future function calls.
The dbm_delete() function only makes le space available for future use; it does not physically
reclaim the space.
If, while making a pass through the database with the dbm_rstkey() and dbm_nextkey() func-
tions, either dbm_store( ) or dbm_delete() is called, dbm_rstkey() should be called to reset
the database before again calling dbm_nextkey().
Be careful when using the dbm_open() function with les in the Guardian (/G) le system. If
the le parameter is longer than ve characters, the dbm_open() function appends the .pag and
.dir extensions accordingly, but the Guardian le system then removes the . character and trun-
cates the name to the eight character maximum, thereby creating two lenames that are identical.
RETURN VALUES
The dbm_open( ) function returns a pointer to a database structure. If an error occurs, it returns (
"DBM *" )0 and sets errno.
The dbm_close( ) function does not return a value.
The dbm_fetch() function returns a datum structure with the contents of the specied record. If
the database does not contain a record with a key that matches the key parameter, or an error
occurs, the dptr eld of the datum structure is a null pointer. When an error occurs, errno is set.
The dbm_store( ) function returns 1 if it was called with a ag value of DBM_INSERT and an
existing record was found with the same key. It returns 0 (zero) for other successes, and negative
values for failures. When the failure is due to an error, errno is set.
The dbm_delete() function returns 0 (zero) when it succeeds, and a negative value when it fails.
When the failure is due to an error, errno is set.
The dbm_rstkey() and dbm_nextkey() functions return a key datum that is the key to a
record in the database. When the end of a database is reached, the dptr eld of the datum is a
null pointer. If an error is detected, the dptr value is also set to null and the error condition of the
database is set.
The dbm_error() function returns 0 (zero) if the databases error condition is not set, and a
nonzero value if it is set.
The return value of the dbm_clearerr() function is unspecied.
EXAMPLES
The following code can be used to traverse the database:
for (key = dbm.rstkey(db); key.dptr !=NULL; key = dbm_netkey(db))
ERRORS
If the following condition occurs, these functions set errno to the corresponding value:
[EINVAL] An invalid parameter was passed to the function.
[ENOMEM] There was insufcient storage space available.
[ENOPERM] A write operation was attempted on a read-only database.
Other errno values may be returned for I/O operations from a failed internal system call to
open(|), read(), write(), and lseek().
527187-004 Hewlett-Packard Company 167