hexpeek.c 904 B

12345678910111213141516171819202122232425262728293031
  1. /*====================================================================*
  2. *
  3. * void hexpeek (void const * memory, size_t origin, size_t offset, size_t extent, size_t window, FILE * fp);
  4. *
  5. * memory.h
  6. *
  7. * print a hexadecimal dump of a memory region on stdout within a
  8. * window that precedes and follows the region;
  9. *
  10. * Motley Tools by Charles Maier;
  11. * Copyright (c) 2001-2006 by Charles Maier Associates;
  12. * Licensed under the Internet Software Consortium License;
  13. *
  14. *--------------------------------------------------------------------*/
  15. #include <stdio.h>
  16. #include <stdint.h>
  17. #include "../tools/memory.h"
  18. void hexpeek (void const * memory, size_t origin, size_t offset, size_t extent, size_t window, FILE * fp)
  19. {
  20. if (offset == origin)
  21. {
  22. offset++;
  23. }
  24. hexdump (memory, window < origin? origin - window: 0, offset + window < extent? offset + window: extent, fp);
  25. return;
  26. }