summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2008-03-01 21:03:35 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2008-03-01 21:03:35 +0100
commit6e08f55368b006fd0d70be0906a728f7dd2f448a (patch)
tree107eebf18d5c6ebba6ad25e5291d76fc053e6cea /commands
parentca558b9097336fc678c7893faad114fe0a7b219a (diff)
downloadbarebox-6e08f55368b006fd0d70be0906a728f7dd2f448a.tar.gz
barebox-6e08f55368b006fd0d70be0906a728f7dd2f448a.tar.xz
memory_display() used to show the ascii output on the
last line not exactly under the other lines. fix it.
Diffstat (limited to 'commands')
-rw-r--r--commands/mem.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/commands/mem.c b/commands/mem.c
index 09565505c4..f6ab538bf9 100644
--- a/commands/mem.c
+++ b/commands/mem.c
@@ -72,23 +72,26 @@ int memory_display(char *addr, ulong offs, ulong nbytes, int size)
uint *uip = (uint *)linebuf;
ushort *usp = (ushort *)linebuf;
u_char *ucp = (u_char *)linebuf;
+ uint count = 52;
printf("%08lx:", offs);
- linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
+ linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
- for (i=0; i<linebytes; i+= size) {
+ for (i = 0; i < linebytes; i += size) {
if (size == 4) {
- printf(" %08x", (*uip++ = *((uint *)addr)));
+ count -= printf(" %08x", (*uip++ = *((uint *)addr)));
} else if (size == 2) {
- printf(" %04x", (*usp++ = *((ushort *)addr)));
+ count -= printf(" %04x", (*usp++ = *((ushort *)addr)));
} else {
- printf(" %02x", (*ucp++ = *((u_char *)addr)));
+ count -= printf(" %02x", (*ucp++ = *((u_char *)addr)));
}
addr += size;
offs += size;
}
- puts (" ");
+ while(count--)
+ putchar(' ');
+
cp = (u_char *)linebuf;
for (i=0; i<linebytes; i++) {
if ((*cp < 0x20) || (*cp > 0x7e))