summaryrefslogtreecommitdiffstats
path: root/python/tdbdump.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:46:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:46:09 +0000
commit48ae1a0fb55b89de931512ffe4afd2c629ae828a (patch)
treea464b4d09295e0d1cdc290e42dc8cc97c4e044fe /python/tdbdump.py
parentInitial commit. (diff)
downloadtdb-48ae1a0fb55b89de931512ffe4afd2c629ae828a.tar.xz
tdb-48ae1a0fb55b89de931512ffe4afd2c629ae828a.zip
Adding upstream version 1.4.8.upstream/1.4.8upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'python/tdbdump.py')
-rw-r--r--python/tdbdump.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/python/tdbdump.py b/python/tdbdump.py
new file mode 100644
index 0000000..afc22d1
--- /dev/null
+++ b/python/tdbdump.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+# Trivial reimplementation of tdbdump in Python
+
+import tdb, sys
+
+if len(sys.argv) < 2:
+ print("Usage: tdbdump.py <tdb-file>")
+ sys.exit(1)
+
+db = tdb.Tdb(sys.argv[1])
+for (k, v) in db.items():
+ print("{\nkey(%d) = %r\ndata(%d) = %r\n}" % (len(k), k, len(v), v))