diff options
author | Jeremy Allison <jra@samba.org> | 2000-10-05 22:19:34 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2000-10-05 22:19:34 +0000 |
commit | 623bfa6c935e2e3acb3145bfbd490758b34d2c70 (patch) | |
tree | 71f18fe7fce3f264606830dea718ecb91ab16fce /source/tdb | |
parent | b90af886a951b7b049ed7a42e6d99c332e43897b (diff) | |
download | samba-623bfa6c935e2e3acb3145bfbd490758b34d2c70.tar.gz samba-623bfa6c935e2e3acb3145bfbd490758b34d2c70.tar.xz samba-623bfa6c935e2e3acb3145bfbd490758b34d2c70.zip |
Fixes from Damian at Cisco to tidy up some tdbtool issues.
Jeremy.
Diffstat (limited to 'source/tdb')
-rw-r--r-- | source/tdb/tdbtool.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/source/tdb/tdbtool.c b/source/tdb/tdbtool.c index 0e2104f3b04..4400f5d8e03 100644 --- a/source/tdb/tdbtool.c +++ b/source/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; |