[tyndur-devel] [PATCH] shell: Fixes fuer bincat
Kevin Wolf ·
! shell: bincat soll die angegebene Laenge auch dann respektieren, wenn sie nicht auf 1024 Bytes ausgerichtet ist ! shell: Offsets in bincat waren um 8 Bytes verrutscht ! shell: An jedem Blockanfang wird rechts das Offset angezeigt. Das war bisher ebenfalls verrutscht und das erste ist auf einer eigenen Zeile gelandet. Signed-off-by: Kevin Wolf <kevin at tyndur.org> --- src/modules/c/shell/cmds/bincat.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/c/shell/cmds/bincat.c b/src/modules/c/shell/cmds/bincat.c index 825e81e..639f066 100644 --- a/src/modules/c/shell/cmds/bincat.c +++ b/src/modules/c/shell/cmds/bincat.c @@ -129,7 +129,7 @@ void bincat_display_usage(void); FILE* file = fopen(path, "r"); lio_seek(file, start, SEEK_SET); - m = start / 8; + m = start - 8; if (file == NULL) { printf("Konnte '%s' nicht zum lesen oeffnen!\n", path); @@ -143,15 +143,20 @@ void bincat_display_usage(void); total_read += size; - printf("0x%08x: ", m); + if (total_read > length) { + size -= total_read - length; + } for (n=0; n < size; n++) { if ((n % 8) == 0) { + if (n == 8) { + printf("0x%08x", m); + } m += 8; printf("\n"); printf("0x%08x: ", m); } - + printf("0x%02x ", ((dword) buffer[n]) & 0xFF); } } -- 1.6.0.2