From b76e942639ab4d75bbf8103f6ea0822466b7615d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 24 Apr 2000 14:36:44 +0000 Subject: dump in a binary format (This used to be commit 41af3232dba90832684ad8260ce0bb05e077cb02) --- source3/tdb/tdbtool.c | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) (limited to 'source3/tdb/tdbtool.c') diff --git a/source3/tdb/tdbtool.c b/source3/tdb/tdbtool.c index 55a58c1d5d..0e2104f3b0 100644 --- a/source3/tdb/tdbtool.c +++ b/source3/tdb/tdbtool.c @@ -7,12 +7,53 @@ #include #include #include +#include #include "tdb.h" /* a tdb tool for manipulating a tdb database */ static TDB_CONTEXT *tdb; + +static void print_asc(unsigned char *buf,int len) +{ + int i; + for (i=0;i8) printf(" "); + while (n--) printf(" "); + + n = i%16; + if (n > 8) n = 8; + print_asc(&buf[i-(i%16)],n); printf(" "); + n = (i%16) - n; + if (n>0) print_asc(&buf[i-n],n); + printf("\n"); + } +} + static void help(void) { printf(" @@ -136,9 +177,10 @@ static void delete_tdb(void) static int print_rec(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) { - printf("%*.*s : %*.*s\n", - (int)key.dsize, (int)key.dsize, key.dptr, - (int)dbuf.dsize, (int)dbuf.dsize, dbuf.dptr); + printf("\nkey %d bytes\n", key.dsize); + print_data(key.dptr, key.dsize); + printf("data %d bytes\n", dbuf.dsize); + print_data(dbuf.dptr, dbuf.dsize); return 0; } -- cgit