dbm.3 (84306) | dbm.3 (108037) |
---|---|
1.\" Copyright (c) 1999 Tim Singletary 2.\" No copyright is claimed. 3.\" 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 14.\" SUCH DAMAGE. 15.\" | 1.\" Copyright (c) 1999 Tim Singletary 2.\" No copyright is claimed. 3.\" 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 14.\" SUCH DAMAGE. 15.\" |
16.\" $FreeBSD: head/lib/libc/db/man/dbm.3 84306 2001-10-01 16:09:29Z ru $ | 16.\" $FreeBSD: head/lib/libc/db/man/dbm.3 108037 2002-12-18 12:45:11Z ru $ |
17.\" 18.\" Note: The date here should be updated whenever a non-trivial 19.\" change is made to the manual page. 20.Dd July 7, 1999 21.Dt DBM 3 22.Os 23.Sh NAME 24.Nm dbm_clearerr , --- 43 unchanged lines hidden (view full) --- 68.Aq Pa ndbm.h : 69.Bd -literal 70typedef struct { 71 char *dptr; 72 int dsize; 73} datum; 74.Ed 75.Pp | 17.\" 18.\" Note: The date here should be updated whenever a non-trivial 19.\" change is made to the manual page. 20.Dd July 7, 1999 21.Dt DBM 3 22.Os 23.Sh NAME 24.Nm dbm_clearerr , --- 43 unchanged lines hidden (view full) --- 68.Aq Pa ndbm.h : 69.Bd -literal 70typedef struct { 71 char *dptr; 72 int dsize; 73} datum; 74.Ed 75.Pp |
76The |
|
76.Fn dbm_open base flags mode | 77.Fn dbm_open base flags mode |
78function |
|
77opens or creates a database. 78.Fa base 79is the basename of the file containing 80the database; the actual database has a 81.Pa .db 82suffix. 83I.e., if 84.Fa base --- 15 unchanged lines hidden (view full) --- 100.Dv O_WRONLY 101is not allowed in 102.Fa flags . 103The pointer returned by 104.Fn dbm_open 105identifies the database and is the 106.Fa db 107argument to the other functions. | 79opens or creates a database. 80.Fa base 81is the basename of the file containing 82the database; the actual database has a 83.Pa .db 84suffix. 85I.e., if 86.Fa base --- 15 unchanged lines hidden (view full) --- 102.Dv O_WRONLY 103is not allowed in 104.Fa flags . 105The pointer returned by 106.Fn dbm_open 107identifies the database and is the 108.Fa db 109argument to the other functions. |
110The |
|
108.Fn dbm_open | 111.Fn dbm_open |
112function |
|
109returns 110.Dv NULL 111and sets 112.Va errno 113if there were any errors. 114.Pp | 113returns 114.Dv NULL 115and sets 116.Va errno 117if there were any errors. 118.Pp |
119The |
|
115.Fn dbm_close db | 120.Fn dbm_close db |
121function |
|
116closes the database. | 122closes the database. |
123The |
|
117.Fn dbm_close | 124.Fn dbm_close |
125function |
|
118normally returns zero. 119.Pp | 126normally returns zero. 127.Pp |
128The |
|
120.Fn dbm_store db key data flags | 129.Fn dbm_store db key data flags |
130function |
|
121inserts or replaces an entry in the database. 122.Fa flags 123is either 124.Dv DBM_INSERT 125or 126.Dv DBM_REPLACE . 127If 128.Fa flags 129is 130.Dv DBM_INSERT 131and the database already contains an entry for 132.Fa key , 133that entry is not replaced. 134Otherwise the entry is replaced or inserted. | 131inserts or replaces an entry in the database. 132.Fa flags 133is either 134.Dv DBM_INSERT 135or 136.Dv DBM_REPLACE . 137If 138.Fa flags 139is 140.Dv DBM_INSERT 141and the database already contains an entry for 142.Fa key , 143that entry is not replaced. 144Otherwise the entry is replaced or inserted. |
145The |
|
135.Fn dbm_store | 146.Fn dbm_store |
147function |
|
136normally returns zero but returns 1 if the entry could not be 137inserted (because 138.Fa flags 139is 140.Dv DBM_INSERT , 141and an entry with 142.Fa key 143already exists) or returns -1 and sets 144.Va errno 145if there were any errors. 146.Pp | 148normally returns zero but returns 1 if the entry could not be 149inserted (because 150.Fa flags 151is 152.Dv DBM_INSERT , 153and an entry with 154.Fa key 155already exists) or returns -1 and sets 156.Va errno 157if there were any errors. 158.Pp |
159The |
|
147.Fn dbm_fetch db key | 160.Fn dbm_fetch db key |
161function |
|
148returns 149.Dv NULL 150or the 151.Fa data 152corresponding to 153.Fa key . 154.Pp | 162returns 163.Dv NULL 164or the 165.Fa data 166corresponding to 167.Fa key . 168.Pp |
169The |
|
155.Fn dbm_delete db key | 170.Fn dbm_delete db key |
171function |
|
156deletes the entry for 157.Fa key . | 172deletes the entry for 173.Fa key . |
174The |
|
158.Fn dbm_delete | 175.Fn dbm_delete |
176function |
|
159normally returns zero but returns 1 if there was no entry with 160.Fa key 161in the database or returns -1 and sets 162.Va errno 163if there were any errors. 164.Pp | 177normally returns zero but returns 1 if there was no entry with 178.Fa key 179in the database or returns -1 and sets 180.Va errno 181if there were any errors. 182.Pp |
183The |
|
165.Fn dbm_firstkey db | 184.Fn dbm_firstkey db |
185function |
|
166returns the first key in the database. | 186returns the first key in the database. |
187The |
|
167.Fn dbm_nextkey db | 188.Fn dbm_nextkey db |
189function |
|
168returns subsequent keys. | 190returns subsequent keys. |
191The |
|
169.Fn db_firstkey | 192.Fn db_firstkey |
193function |
|
170must be called before 171.Fn dbm_nextkey . 172The order in which keys are returned is unspecified and may appear 173random. | 194must be called before 195.Fn dbm_nextkey . 196The order in which keys are returned is unspecified and may appear 197random. |
198The |
|
174.Fn dbm_nextkey | 199.Fn dbm_nextkey |
200function |
|
175returns 176.Dv NULL 177after all keys have been returned. 178.Pp | 201returns 202.Dv NULL 203after all keys have been returned. 204.Pp |
205The |
|
179.Fn dbm_error db | 206.Fn dbm_error db |
207function |
|
180returns the 181.Va errno 182value of the most recent error. | 208returns the 209.Va errno 210value of the most recent error. |
211The |
|
183.Fn dbm_clearerr db | 212.Fn dbm_clearerr db |
213function |
|
184resets this value to 0 and returns 0. 185.Pp | 214resets this value to 0 and returns 0. 215.Pp |
216The |
|
186.Fn dbm_dirfno db | 217.Fn dbm_dirfno db |
218function |
|
187returns the file descriptor to the database. 188.Sh SEE ALSO 189.Xr open 2 , 190.Xr dbopen 3 , 191.Xr hash 3 192.Sh STANDARDS 193These functions (except 194.Fn dbm_dirfno ) 195are included in the 196.St -susv2 . | 219returns the file descriptor to the database. 220.Sh SEE ALSO 221.Xr open 2 , 222.Xr dbopen 3 , 223.Xr hash 3 224.Sh STANDARDS 225These functions (except 226.Fn dbm_dirfno ) 227are included in the 228.St -susv2 . |