diff options
author | hploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b> | 2006-11-24 22:50:17 +0000 |
---|---|---|
committer | hploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b> | 2006-11-24 22:50:17 +0000 |
commit | f45e4df652811ed25242c83807d67063417446f9 (patch) | |
tree | 40728ff3dc28bf3b2b91ed0f692bfaaf119b31ed | |
parent | 07ced57fcd3d1dc73267a478b42b3d688e089556 (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
-rw-r--r-- | utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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 |