📄 tdb_firstkey.3
字号:
.TH tdb_firskey "Aug 16, 2000" "Samba" "Linux Programmer's Manual".SH NAMEtdb_firstkey - return the key of the first record in a tdb databasetdb_nextkey - return the key of next record in the tdb database.SH SYNOPSIS.nf.B #include <tdb.h>.sp.BI "TDB_DATA tdb_firstkey(TDB_CONTEXT *" tdb ");".BI "TDB_DATA tdb_nextkey(TDB_CONTEXT *" tdb ", TDB_DATA " prev_key ");".sp.SH DESCRIPTION.I tdb_firstkey fetches the key of the first entry in the .I tdb database..I tdb_nextkeyfetches the key of the entry immediately after .I prev_keyin the database..sp The TDB_DATA structure returned by both these functions is defined as:.PP.RS.nftypedef struct { char *dptr; size_t dsize;} TDB_DATA;.fi.RE.PP.spThe order in which this traverses the database is its own internalhash order. Do not expect the keys to be in any recognizably sortedorder..spThese functions are reliable even if other writers are accessing thedatabase (or you are replacing or deleting elements as you traverse),except in the case of nested.I tdb_firstkeyor.I tdb_nextkeycalls. For example, the following outer traversal may fail totraverse all the elements, or may even traverse elements twice ifother processes are manipulating the database:.PP.RS.nf TDB_DATA i, j; for (i = tdb_firstkey(tdb); i.dptr; i = tdb_nextkey(tdb, i)) { for (j = tdb_firstkey(tdb); j.dptr; j = tdb_nextkey(tdb, j)) { ... } }.fi.RE.PPIf such behaviour is desired, use.I tdb_traverseinstead..sp.SH "RETURN VALUE"If the call succeeds, then a TDB_DATA structure is returned with the.I dptr structure filled in. If the call fails or you have reached the end ofthe database then.I dptr will be set to NULL..sp.B NOTE:The caller is responsible for freeing the data pointed to by.I dptr..SH AUTHORSSoftware: Andrew Tridgell <tridge@linuxcare.com> and Luke Kenneth Casson LeightonMan page: Ben Woodard <ben@valinux.com>.SH "SEE ALSO".BR gdbm (3),.BR tdb(3)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -