Manual Pages for UNIX Darwin command on man dbm_dirfno
MyWebUniversity

Manual Pages for UNIX Darwin command on man dbm_dirfno

DBM(3) BSD Library Functions Manual DBM(3)

NAME

ddbbmmcclleeaarreerrrr, ddbbmmcclloossee, ddbbmmddeelleettee, ddbbmmddiirrffnnoo, ddbbmmeerrrroorr, ddbbmmffeettcchh,

ddbbmmffiirrssttkkeeyy, ddbbmmnneexxttkkeeyy, ddbbmmooppeenn, ddbbmmssttoorree - database access func-

tions

SYNOPSIS

##iinncclluuddee <>

int ddbbmmcclleeaarreerrrr(DBM *db); void ddbbmmcclloossee(DBM *db); int ddbbmmddeelleettee(DBM *db, datum key); int ddbbmmddiirrffnnoo(DBM *db); int ddbbmmeerrrroorr(DBM *db); datum ddbbmmffeettcchh(DBM *db, datum key); datum ddbbmmffiirrssttkkeeyy(DBM *db); datum ddbbmmnneexxttkkeeyy(DBM *db); DBM * ddbbmmooppeenn(const char *file, int openflags, modet filemode); int ddbbmmssttoorree(DBM *db, datum key, datum content, int storemode);

DESCRIPTION

Database access functions. These functions are implemented using dbopen(3) with a hash(3) database. datum is declared in : typedef struct { char *dptr; int dsize; } datum; The ddbbmmooppeenn(file, openflags, filemode) function opens or creates a database file. The file argument is the basename of the file containing the database; the actual database has a .db suffix. I.e., if file is "/home/me/mystuff" then the actual database is in the file /home/me/mystuff.db. The openflags and filemode arguments are passed to open(2). (ORDWR | OCREAT) is a typical value for openflags; 0660 is a typical value for filemode. OWRONLY is treated as ORDWR in openflags. The pointer returned by ddbbmmooppeenn() identifies the database and is the db argument to the other functions. The ddbbmmooppeenn() function returns NULL and sets errno if there were any errors. The ddbbmmcclloossee(db) function closes the database. The ddbbmmcclloossee() function normally returns zero. The ddbbmmssttoorree(db, key, content, storemode) function inserts or replaces an entry in the database. The storemode argument is either DBMINSERT or DBMREPLACE. If storemode is DBMINSERT and the database already contains an entry for key, that entry is not replaced. Otherwise the entry is replaced or inserted. The ddbbmmssttoorree() function normally returns zero but returns 1 if the entry could not be inserted (because storemode

is DBMINSERT, and an entry with key already exists) or returns -1 and

sets errno if there were any errors. The ddbbmmffeettcchh(db, key) function returns NULL or the content corresponding to key. The ddbbmmddeelleettee(db, key) function deletes the entry for key. The ddbbmmddeelleettee() function normally returns zero but returns 1 if there was no

entry with key in the database or returns -1 and sets errno if there were

any errors. The ddbbmmffiirrssttkkeeyy(db) function returns the first key in the database. The ddbbmmnneexxttkkeeyy(db) function returns subsequent keys. The ddbbffiirrssttkkeeyy() function must be called before ddbbmmnneexxttkkeeyy(). The order in which keys are returned is unspecified and may appear random. The ddbbmmnneexxttkkeeyy() function returns NULL after all keys have been returned. The ddbbmmeerrrroorr(db) function returns the errno value of the most recent error. The ddbbmmcclleeaarreerrrr(db) function resets this value to 0 and returns 0. The ddbbmmddiirrffnnoo(db) function returns the file descriptor to the database.

LEGACY SYNOPSIS

##iinncclluuddee <>

##iinncclluuddee <>

The include file is necessary for all functions. DBM * ddbbmmooppeenn(const char *file, int openflags, int filemode); filemode has type int.

SEE ALSO

open(2), dbopen(3), hash(3), compat(5) STANDARDS These functions (except ddbbmmddiirrffnnoo()) are included in the Version 2 of the Single UNIX Specification (``SUSv2''). BSD July 7, 1999 BSD




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™