Add a prefix string parameter. Callers are responsible for any
string length/alignment that they want to see in the output. I.e.,
callers should pad strings to achieve alignment if they want that.
Add rowsize parameter. This is the number of raw data bytes
to be printed per line. Must be 16 or 32.
Add a group_size parameter. This allows callers to dump values
as 1-byte, 2-byte, 4-byte, or 8-byte numbers. Default is
1-byte numbers. If the total length is not an even multiple
of group_size, 1-byte numbers are printed.
Add an "ascii" output parameter. This causes ASCII data output[...]
following the hex data output.
+ if (!ascii)
+ goto nil;
+
+ if ((lx + 1) < linebuflen)
linebuf[lx++] = ' ';
- }
- for (j = 0; (j < 16) && (j < len) && (lx + 2) < linebuflen; j++)
+ for (j = 0; (j < rowsize) && (j < len) && (lx + 2) < linebuflen; j++)
linebuf[lx++] = isprint(ptr[j]) ? ptr[j] : '.';
+nil:
linebuf[lx++] = '\0';