From d0ea72d0b7c6a9ea0f582cda3b94ba7cb8cb1fbe Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 28 Nov 2001 03:58:33 +0000 Subject: Added a 'keys' command to tdbtool which prints out all keys in the tdb. (This used to be commit 1d2305c233ef40ccb016688f918e34392d1a691e) --- source3/tdb/tdbtool.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source3/tdb/tdbtool.c b/source3/tdb/tdbtool.c index 86b534fb01..4e674664b7 100644 --- a/source3/tdb/tdbtool.c +++ b/source3/tdb/tdbtool.c @@ -306,6 +306,13 @@ static int print_rec(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) #endif } +static int print_key(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) +{ + printf("\nkey %d bytes\n", key.dsize); + print_data(key.dptr, key.dsize); + return 0; +} + static int total_bytes; static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) @@ -445,6 +452,9 @@ int main(int argc, char *argv[]) } else if ((strcmp(tok, "n") == 0) || (strcmp(tok, "next") == 0)) { next_record(tdb, &iterate_kbuf); + } else if ((strcmp(tok, "keys") == 0)) { + bIterate = 0; + tdb_traverse(tdb, print_key, NULL); } else { help(); } -- cgit