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
16 .\" $FreeBSD: src/lib/libc/db/man/dbm.3,v 1.2.2.5 2003/03/15 15:11:05 trhodes Exp $
17 .\" $DragonFly: src/lib/libc/db/man/dbm.3,v 1.5 2008/05/10 18:22:41 swildner Exp $
19 .\" Note: The date here should be updated whenever a non-trivial
20 .\" change is made to the manual page.
35 .Nd database access functions
42 .Fn dbm_open "const char *base" "int flags" "int mode"
44 .Fn dbm_close "DBM *db"
46 .Fn dbm_store "DBM *db" "datum key" "datum data" "int flags"
48 .Fn dbm_fetch "DBM *db" "datum key"
50 .Fn dbm_delete "DBM *db" "datum key"
52 .Fn dbm_firstkey "DBM *db"
54 .Fn dbm_nextkey "DBM *db"
56 .Fn dbm_error "DBM *db"
58 .Fn dbm_clearerr "DBM *db"
60 .Fn dbm_dirfno "DBM *db"
62 Database access functions.
63 These functions are implemented using
80 .Fn dbm_open base flags mode
82 opens or creates a database.
86 is the basename of the file containing
87 the database; the actual database has a
93 .Qq Li /home/me/mystuff
94 then the actual database is in the file
95 .Pa /home/me/mystuff.db .
103 .Pq Dv O_RDWR | O_CREAT
104 is a typical value for
107 is a typical value for
112 The pointer returned by
114 identifies the database and is the
116 argument to the other functions.
124 if there were any errors.
133 normally returns zero.
136 .Fn dbm_store db key data flags
138 inserts or replaces an entry in the database.
150 and the database already contains an entry for
152 that entry is not replaced.
153 Otherwise the entry is replaced or inserted.
157 normally returns zero but returns 1 if the entry could not be
164 already exists) or returns -1 and sets
166 if there were any errors.
179 .Fn dbm_delete db key
181 deletes the entry for
186 normally returns zero but returns 1 if there was no entry with
188 in the database or returns -1 and sets
190 if there were any errors.
195 returns the first key in the database.
199 returns subsequent keys.
203 must be called before
205 The order in which keys are returned is unspecified and may appear
212 after all keys have been returned.
219 value of the most recent error.
223 resets this value to 0 and returns 0.
228 returns the file descriptor to the database.
234 These functions (except