mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 12:09:58 +00:00
3568ac2a6e
On FreeBSD libutil is used for openpty(), but it also provides a hexdump() which conflicts with QEMU's. Signed-off-by: Ed Maste <emaste@freebsd.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1368718348-15199-1-git-send-email-emaste@freebsd.org Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
38 lines
1002 B
C
38 lines
1002 B
C
/*
|
|
* Helper to hexdump a buffer
|
|
*
|
|
* Copyright (c) 2013 Red Hat, Inc.
|
|
* Copyright (c) 2013 Gerd Hoffmann <kraxel@redhat.com>
|
|
* Copyright (c) 2013 Peter Crosthwaite <peter.crosthwaite@xilinx.com>
|
|
* Copyright (c) 2013 Xilinx, Inc
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2. See
|
|
* the COPYING file in the top-level directory.
|
|
*
|
|
* Contributions after 2012-01-13 are licensed under the terms of the
|
|
* GNU GPL, version 2 or (at your option) any later version.
|
|
*/
|
|
|
|
#include "qemu-common.h"
|
|
|
|
void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t size)
|
|
{
|
|
unsigned int b;
|
|
|
|
for (b = 0; b < size; b++) {
|
|
if ((b % 16) == 0) {
|
|
fprintf(fp, "%s: %04x:", prefix, b);
|
|
}
|
|
if ((b % 4) == 0) {
|
|
fprintf(fp, " ");
|
|
}
|
|
fprintf(fp, " %02x", (unsigned char)buf[b]);
|
|
if ((b % 16) == 15) {
|
|
fprintf(fp, "\n");
|
|
}
|
|
}
|
|
if ((b % 16) != 0) {
|
|
fprintf(fp, "\n");
|
|
}
|
|
}
|