aboutsummaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
authorhploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b>2006-11-24 22:50:17 +0000
committerhploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b>2006-11-24 22:50:17 +0000
commitf45e4df652811ed25242c83807d67063417446f9 (patch)
tree40728ff3dc28bf3b2b91ed0f692bfaaf119b31ed /utils.py
parent07ced57fcd3d1dc73267a478b42b3d688e089556 (diff)
make it possible to print an arbitrary offset
git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@144 f711b948-2313-0410-aaa9-d29f33439f0b
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/utils.py b/utils.py
index e9cc38b..582da63 100644
--- a/utils.py
+++ b/utils.py
@@ -37,7 +37,7 @@ def parse_binary(value, bytemasks, verbose = False, value_len = 8):
return result
_myprintable = " " + string.letters + string.digits + string.punctuation
-def hexdump(data, indent = 0, short = False, linelen = 16):
+def hexdump(data, indent = 0, short = False, linelen = 16, offset = 0):
r"""Generates a nice hexdump of data and returns it. Consecutive lines will
be indented with indent spaces. When short is true, will instead generate
hexdump without adresses and on one line.
@@ -63,7 +63,7 @@ def hexdump(data, indent = 0, short = False, linelen = 16):
while len(head) > 0:
if pos > 0:
result = result + "\n%s" % (' ' * indent)
- result = result + FORMATSTRING % (pos, hexable(head), printable(head))
+ result = result + FORMATSTRING % (pos+offset, hexable(head), printable(head))
pos = pos + len(head)
(head, tail) = (tail[:linelen], tail[linelen:])
return result