mdoc(7) cleanup.

This commit is contained in:
Ruslan Ermilov 2001-02-12 15:16:24 +00:00
parent df17ff7fa5
commit 95cf33c567

View File

@ -18,17 +18,18 @@
.\" Note: The date here should be updated whenever a non-trivial
.\" change is made to the manual page.
.Dd July 7, 1999
.Dt dbm 3
.Dt DBM 3
.Os
.Sh NAME
.Nm dbm_clearerr Ns No ,
.Nm dbm_close Ns No ,
.Nm dbm_delete Ns No ,
.Nm dbm_dirfno Ns No ,
.Nm dbm_error Ns No ,
.Nm dbm_fetch Ns No ,
.Nm dbm_firstkey Ns No ,
.Nm dbm_nextkey Ns No ,
.Nm dbm_open Ns No ,
.Nm dbm_clearerr ,
.Nm dbm_close ,
.Nm dbm_delete ,
.Nm dbm_dirfno ,
.Nm dbm_error ,
.Nm dbm_fetch ,
.Nm dbm_firstkey ,
.Nm dbm_nextkey ,
.Nm dbm_open ,
.Nm dbm_store
.Nd database access functions
.Sh SYNOPSIS
@ -54,147 +55,142 @@
.Fn dbm_clearerr "DBM *db"
.Ft int
.Fn dbm_dirfno "DBM *db"
.Sh DESCRIPTION
Database access functions.
These functions are implemented using
.Fn dbopen
(see
.Xr dbopen 3 Ns No )
with a
.Nm hash
(see
.Xr hash 3 Ns No )
These functions are implemented using
.Xr dbopen 3
with a
.Xr hash 3
database.
.Fa datum
.Pp
.Vt datum
is declared in
.Pa ndbm.h Ns No :
.Aq Pa ndbm.h :
.Bd -literal
typedef struct {
char *dptr;
int dsize;
char *dptr;
int dsize;
} datum;
.Ed
.Pp
.Fn dbm_open base flags mode
opens or creates a database.
.Fa base No is the basename of the file containing
.Fa base
is the basename of the file containing
the database; the actual database has a
.Sq .db
suffix. I.e., if
.Pa .db
suffix.
I.e., if
.Fa base
is
.Pa /home/me/mystuff
.Qq Li /home/me/mystuff
then the actual database is in the file
.Pa /home/me/mystuff.db Ns No .
.Fa flags No and
.Fa mode No are passed to
.Fn open No (see
.Xr open 2 Ns No ).
.Li O_RDWR | O_CREAT
.Pa /home/me/mystuff.db .
.Fa flags
and
.Fa mode
are passed to
.Xr open 2 .
.Pq Dv O_RDWR \*(Ba O_CREAT
is a typical value for
.Fa flags Ns No ;
.Fa flags ;
.Li 0660
is a typical value for
.Fa mode Ns No .
.Li O_WRONLY
.Fa mode .
.Dv O_WRONLY
is not allowed in
.Fa flags Ns No .
.Fa flags .
The pointer returned by
.Fn dbm_open
identifies the database and is the
.Fa db
argument to the other functions.
.Fn dbm_open
returns
.Li NULL
and sets
.Fn dbm_open
returns
.Dv NULL
and sets
.Va errno
if there are any errors.
if there were any errors.
.Pp
.Fn dbm_close db
closes the database.
.Fn dbm_close
normally returns zero.
.Pp
.Fn dbm_store db key data flags
inserts or replaces an entry in the database.
.Fa flags No is either
.Li DBM_INSERT
or
.Li DBM_REPLACE Ns No .
If
.Fa flags
is
.Li DBM_INSERT
and the database already contains an entry for
.Fa key Ns No ,
that entry is not replaced. Otherwise the entry is replaced or inserted.
.Fn dbm_store
normally returns returns zero but returns 1 if the entry could not be
inserted (because
inserts or replaces an entry in the database.
.Fa flags
is either
.Dv DBM_INSERT
or
.Dv DBM_REPLACE .
If
.Fa flags
is
.Li DBM_INSERT
.Dv DBM_INSERT
and the database already contains an entry for
.Fa key ,
that entry is not replaced.
Otherwise the entry is replaced or inserted.
.Fn dbm_store
normally returns returns zero but returns 1 if the entry could not be
inserted (because
.Fa flags
is
.Dv DBM_INSERT ,
and an entry with
.Fa key
already exists) or returns -1 and sets
.Va errno
if there were any errors.
.Pp
.Fn dbm_fetch db key
returns
.Li NULL
returns
.Dv NULL
or the
.Fa data
corresponding to
.Fa key Ns No .
.Fa data
corresponding to
.Fa key .
.Pp
.Fn dbm_delete db key
deletes the entry for
.Fa key Ns No .
.Fa key .
.Fn dbm_delete
normally returns zero but returns 1 if there was no entry with
.Fa key
in the database or returns -1 and sets
.Va errno
in the database or returns -1 and sets
.Va errno
if there were any errors.
.Pp
.Fn dbm_firstkey db
returns the first key in the database.
.Fn dbm_nextkey db
returns subsequent keys.
.Fn db_firstkey
must be called before
.Fn dbm_nextkey.
returns subsequent keys.
.Fn db_firstkey
must be called before
.Fn dbm_nextkey .
The order in which keys are returned is unspecified and may appear
random.
.Fn dbm_nextkey
returns
.Li NULL
returns
.Dv NULL
after all keys have been returned.
.Pp
.Fn dbm_error db
returns the
returns the
.Va errno
value of the most recent error.
.Fn dbm_clearerr db
resets this value to 0 and returns 0.
.Pp
.Fn dbm_dirfno db
returns the file descriptor to the database.
.Sh SEE ALSO
.Xr dbopen 3 Ns ,
.Xr hash 3 Ns ,
.Xr open 2
.Xr open 2 ,
.Xr dbopen 3 ,
.Xr hash 3
.Sh STANDARDS
These functions (except
.Fn dbm_dirfno Ns No )
are included in the Single Unix Specification for Unix 98.
These functions (except
.Fn dbm_dirfno )
are included in the
.St -susv2 .