On Wed, 27 Sep 2006 13:47:18 -0700
James Ketrenos <[email protected]> wrote:
> +static int snprint_line(char *buf, size_t count,
> + const u8 * data, u32 len, u32 ofs)
> +{
> + int out, i, j, l;
> + char c;
> +
> + out = snprintf(buf, count, "%08X", ofs);
> +
> + for (l = 0, i = 0; i < 2; i++) {
> + out += snprintf(buf + out, count - out, " ");
> + for (j = 0; j < 8 && l < len; j++, l++)
> + out += snprintf(buf + out, count - out, "%02X ",
> + data[(i * 8 + j)]);
> + for (; j < 8; j++)
> + out += snprintf(buf + out, count - out, " ");
> + }
> +
> + out += snprintf(buf + out, count - out, " ");
> + for (l = 0, i = 0; i < 2; i++) {
> + out += snprintf(buf + out, count - out, " ");
> + for (j = 0; j < 8 && l < len; j++, l++) {
> + c = data[(i * 8 + j)];
> + if (!isascii(c) || !isprint(c))
> + c = '.';
> +
> + out += snprintf(buf + out, count - out, "%c", c);
> + }
> +
> + for (; j < 8; j++)
> + out += snprintf(buf + out, count - out, " ");
> + }
> +
> + return out;
> +}
I've occasionally felt that the kernel should have a generic
print-a-hunk-of-memory function (slab.c has two open-coded
implementations already).
What does the output of this one look like?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]