1 .\" $NetBSD: dbm_clearerr.3,v 1.3 2004/05/06 19:16:32 wiz Exp $
3 .\" Copyright (c) 2004 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
45 .Nd database functions
51 .Fn dbm_clearerr "DBM *db"
53 .Fn dbm_close "DBM *db"
55 .Fn dbm_delete "DBM *db" "datum key"
57 .Fn dbm_dirfno "DBM *db"
59 .Fn dbm_error "DBM *db"
61 .Fn dbm_fetch "DBM *db" "datum key"
63 .Fn dbm_firstkey "DBM *db"
65 .Fn dbm_nextkey "DBM *db"
67 .Fn dbm_open "const char *file" "int open_flags" "mode_t file_mode"
69 .Fn dbm_store "DBM *db" "datum key" "datum content" "int store_mode"
73 facility provides access to hash database files.
75 Two data types are fundamental to the
79 serves as a handle to a database.
82 The other data type is
84 which is a structure type which includes the following members:
85 .Bd -literal -offset indent
94 pointing at an object of
100 function opens a database.
103 argument is the pathname which the actual database file pathname
105 This implementation uses a single file with the suffix
111 argument has the same meaning as the
115 except that when opening a database for write-only access the file
116 is opened for read/write access, and the
118 flag must not be specified.
121 argument has the same meaning as the
126 For the following functions, the
128 argument is a handle previously returned by a call to
133 function closes a database.
137 function retrieves a record from the database.
142 that identifies the record to be fetched.
146 function stores a record into the database.
151 that identifies the record to be stored.
156 that specifies the value of the record to be stored.
159 argument specifies the behavior of
163 is already present in the database,
166 must be one of the following:
167 .Bl -tag -width DBM_REPLACEXX -offset indent
171 is already present, it is left unchanged.
175 is already present, its value is replaced by
179 If no record matching
181 is present, a new record is inserted regardless of
186 function deletes a record from the database.
191 that identifies the record to be deleted.
195 function returns the first key in the database.
199 function returns the next key in the database.
200 In order to be meaningful, it must be preceded by a call to
205 function returns the error indicator of the database.
209 function clears the error indicator of the database.
213 function returns the file descriptor of the underlying database file.
214 .Sh IMPLEMENTATION NOTES
217 facility is implemented on top of the
225 function returns a pointer to a
227 when successful; otherwise a null pointer is returned.
231 function returns no value.
235 function returns a content
237 if no record matching
239 was found or if an error occured, its
241 member is a null pointer.
245 function returns 0 when then record was successfully inserted;
246 it returns 1 when called with
250 and a record matching
253 otherwise a negative value is returned.
257 function returns 0 when the record was successfully deleted;
258 otherwise a negative value is returned.
264 functions return a key
266 When the end of the database is reached or if an error occured, its
268 member is a null pointer.
272 function returns 0 if the error indicator is clear;
273 if the error indicator is set a non-zero value is returned.
277 function always returns 0.
281 function returns the file descriptor of the underlying database file.
283 No errors are defined.
304 function is an extension.