summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-10-05 22:19:34 +0000
committerJeremy Allison <jra@samba.org>2000-10-05 22:19:34 +0000
commita6f31d68777c2b426f99317390c92b2951b4fa6a (patch)
treed6146efaebcb8141a05b1f3ff7b92736d281615a
parent94c63f6ca473306a3e5607d76aa05a63a9da765c (diff)
downloadsamba-a6f31d68777c2b426f99317390c92b2951b4fa6a.tar.gz
samba-a6f31d68777c2b426f99317390c92b2951b4fa6a.tar.bz2
samba-a6f31d68777c2b426f99317390c92b2951b4fa6a.zip
Fixes from Damian at Cisco to tidy up some tdbtool issues.
Jeremy. (This used to be commit 623bfa6c935e2e3acb3145bfbd490758b34d2c70)
-rw-r--r--source3/tdb/tdbtool.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/source3/tdb/tdbtool.c b/source3/tdb/tdbtool.c
index 0e2104f3b0..4400f5d8e0 100644
--- a/source3/tdb/tdbtool.c
+++ b/source3/tdb/tdbtool.c
@@ -14,6 +14,7 @@
static TDB_CONTEXT *tdb;
+static int print_rec(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state);
static void print_asc(unsigned char *buf,int len)
{
@@ -150,11 +151,12 @@ static void show_tdb(void)
}
key.dptr = k;
- key.dsize = strlen(k);
+ key.dsize = strlen(k)+1;
dbuf = tdb_fetch(tdb, key);
if (!dbuf.dptr) terror("fetch failed");
- printf("%s : %*.*s\n", k, (int)dbuf.dsize, (int)dbuf.dsize, dbuf.dptr);
+ /* printf("%s : %*.*s\n", k, (int)dbuf.dsize, (int)dbuf.dsize, dbuf.dptr); */
+ print_rec(tdb, key, dbuf, NULL);
}
static void delete_tdb(void)
@@ -222,7 +224,14 @@ int main(int argc, char *argv[])
{
char *line;
char *tok;
-
+
+ if (argv[1]) {
+ static char tmp[1024];
+ sprintf(tmp, "open %s", argv[1]);
+ tok=strtok(tmp," ");
+ open_tdb();
+ }
+
while ((line = getline("tdb> "))) {
/* Shell command */
@@ -232,7 +241,9 @@ int main(int argc, char *argv[])
continue;
}
- tok = strtok(line," ");
+ if ((tok = strtok(line," "))==NULL) {
+ continue;
+ }
if (strcmp(tok,"create") == 0) {
create_tdb();
continue;