1 .\" Copyright (c) 1999 Tim Singletary
2 .\" No copyright is claimed.
4 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
5 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
6 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
7 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
8 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
9 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
10 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
11 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
12 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
13 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .Nd database access functions
37 .Fn dbm_open "const char *base" "int flags" "mode_t mode"
39 .Fn dbm_close "DBM *db"
41 .Fn dbm_store "DBM *db" "datum key" "datum data" "int flags"
43 .Fn dbm_fetch "DBM *db" "datum key"
45 .Fn dbm_delete "DBM *db" "datum key"
47 .Fn dbm_firstkey "DBM *db"
49 .Fn dbm_nextkey "DBM *db"
51 .Fn dbm_error "DBM *db"
53 .Fn dbm_clearerr "DBM *db"
55 .Fn dbm_dirfno "DBM *db"
57 Database access functions.
58 These functions are implemented using
75 .Fn dbm_open base flags mode
77 opens or creates a database.
81 is the basename of the file containing
82 the database; the actual database has a
88 .Qq Li /home/me/mystuff
89 then the actual database is in the file
90 .Pa /home/me/mystuff.db .
98 .Pq Dv O_RDWR | O_CREAT
99 is a typical value for
102 is a typical value for
107 The pointer returned by
109 identifies the database and is the
111 argument to the other functions.
119 if there were any errors.
127 .Fn dbm_store db key data flags
129 inserts or replaces an entry in the database.
141 and the database already contains an entry for
143 that entry is not replaced.
144 Otherwise the entry is replaced or inserted.
148 normally returns zero but returns 1 if the entry could not be
155 already exists) or returns -1 and sets
157 if there were any errors.
170 .Fn dbm_delete db key
172 deletes the entry for
177 normally returns zero or returns -1 and sets
179 if there were any errors.
184 returns the first key in the database.
188 returns subsequent keys.
192 must be called before
194 The order in which keys are returned is unspecified and may appear
201 after all keys have been returned.
208 value of the most recent error.
212 resets this value to 0 and returns 0.
217 returns the file descriptor to the database.
223 These functions (except