2009-02-02 Christian Franke <franke@computer.org>

* lib/hexdump.c (hexdump): Print at most 3 lines if data is identical.
This commit is contained in:
chrfranke 2009-02-02 19:43:14 +00:00
parent de3aa26079
commit b4315fb069
2 changed files with 20 additions and 0 deletions

View file

@ -61,6 +61,22 @@ hexdump (unsigned long bse, char *buf, int len)
grub_printf ("%s\n", line);
/* Print only first and last line if more than 3 lines are identical. */
if (len >= 4 * 16
&& ! grub_memcmp (buf, buf + 1 * 16, 16)
&& ! grub_memcmp (buf, buf + 2 * 16, 16)
&& ! grub_memcmp (buf, buf + 3 * 16, 16))
{
grub_printf ("*\n");
do
{
bse += 16;
buf += 16;
len -= 16;
}
while (len >= 3 * 16 && ! grub_memcmp (buf, buf + 2 * 16, 16));
}
bse += 16;
buf += 16;
len -= cnt;