Re: [PATCH 1/4] Cleaned hexadecimal dump

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2015-03-07 at 12:56 -0500, Adrian Remonda wrote:
> Signed-off-by: Adrian Remonda <adrianremonda@xxxxxxxxx>
[]
> diff --git a/Documentation/spi/spidev_test.c b/Documentation/spi/spidev_test.c
[]
> +static void hexDump(const void *src, size_t length, size_t bLine, char *prefix)
> +{

Is there something necessary that print_hex_dump can't do?

> +	int i = 0;
> +	char *address = (char *)src;
> +	char *line = (char *)address;
> +	unsigned char c;
> +
> +	printf("%s | ", prefix);
> +	while (length-- > 0) {
> +		printf("%02X ", (unsigned char)*address++);
> +		if (!(++i % bLine) || (length == 0 && i % bLine)) {
> +			if (length == 0) {
> +				while (i++ % bLine)
> +					printf("__ ");
> +			}
> +			printf(" | ");  /* right close */
> +			while (line < address) {
> +				c = *line++;
> +				printf("%c", (c < 33 || c == 255) ? 0x2E : c);
> +			}
> +			printf("\n");
> +			if (length > 0)
> +				printf("%s | ", prefix);
> +		}
> +	}
> +}



--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux