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.8 2003/09/08 19:57:13 ru Exp $
18 .\" Note: The date here should be updated whenever a non-trivial
19 .\" change is made to the manual page.
34 .Nd database access functions
73 .Fa "const char *file"
75 .Fa "mode_t file_mode"
85 Database access functions.
86 These functions are implemented using
103 .Fn dbm_open file open_flags file_mode
105 opens or creates a database file.
109 is the basename of the file containing
110 the database; the actual database has a
116 .Qq Li /home/me/mystuff
117 then the actual database is in the file
118 .Pa /home/me/mystuff.db .
126 .Pq Dv O_RDWR | O_CREAT
127 is a typical value for
130 is a typical value for
133 is treated as O_RDWR in
135 The pointer returned by
137 identifies the database and is the
139 argument to the other functions.
147 if there were any errors.
156 normally returns zero.
159 .Fn dbm_store db key content store_mode
161 inserts or replaces an entry in the database.
173 and the database already contains an entry for
175 that entry is not replaced.
176 Otherwise the entry is replaced or inserted.
180 normally returns zero but returns 1 if the entry could not be
187 already exists) or returns -1 and sets
189 if there were any errors.
202 .Fn dbm_delete db key
204 deletes the entry for
209 normally returns zero but returns 1 if there was no entry with
211 in the database or returns -1 and sets
213 if there were any errors.
218 returns the first key in the database.
222 returns subsequent keys.
226 must be called before
228 The order in which keys are returned is unspecified and may appear
235 after all keys have been returned.
242 value of the most recent error.
246 resets this value to 0 and returns 0.
251 returns the file descriptor to the database.
253 .Fd #include <fcntl.h>
254 .Fd #include <ndbm.h>
258 is necessary for all functions.
263 .Fa "const char *file"
277 These functions (except