From 3e187c094f12ef41ea6de2f55d128c3e037b5c12 Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Wed, 25 Sep 2019 19:17:09 +0100 Subject: Untested version, recompiled with new buf library and with c+ --- cmd/cmd_dumpx.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'cmd/cmd_dumpx.c') diff --git a/cmd/cmd_dumpx.c b/cmd/cmd_dumpx.c index 3e6cdf1..ecca20c 100644 --- a/cmd/cmd_dumpx.c +++ b/cmd/cmd_dumpx.c @@ -8,26 +8,28 @@ #include "libcmd/cmd_parse.h" extern file_t *g_file; -extern buf_t *g_buf; +extern Buf *g_buf; extern int g_flags; int c_dumpx( cmd_arg_t *arg ) { int i,j; - if ( g_buf->buf == NULL) + if ( g_buf->isempty() ) { printf("Buffer to print empty\n"); return -1; } - for (i=0; isize; i+=16) + for (i=0; isize(); i+=16) { for (j=i; jsize ) + if ( jsize() ) { - printf("%02x ",(unsigned char)g_buf->buf[j]); + char c; + g_buf->getc(j,&c); + printf("%02x ",(unsigned char)c); } else { printf(" "); @@ -36,11 +38,14 @@ int c_dumpx( cmd_arg_t *arg ) for (j=i; jsize ) //wrong place move to cycle? + if ( jsize() ) //wrong place move to cycle? { - if ( isprint(g_buf->buf[j]) ) + char c; + g_buf->getc(j,&c); + if ( isprint(c) ) { - printf("%c",(unsigned char)g_buf->buf[j]); + + printf("%c",(unsigned char)c); } else { printf("\e[7m.\e[0m"); -- cgit v1.2.3