xref: /freebsd/sbin/ipf/libipf/binprint.c (revision 3c4ba5f55438f7afd4f4b0b56f88f2bb505fd6a6)
1 /*	$FreeBSD$	*/
2 
3 /*
4  * Copyright (C) 2012 by Darren Reed.
5  *
6  * See the IPFILTER.LICENCE file for details on licencing.
7  *
8  * $Id$
9  */
10 
11 #include "ipf.h"
12 
13 
14 void
15 binprint(void *ptr, size_t size)
16 {
17 	u_char *s;
18 	int i, j;
19 
20 	for (i = size, j = 0, s = (u_char *)ptr; i; i--, s++) {
21 		j++;
22 		printf("%02x ", *s);
23 		if (j == 16) {
24 			printf("\n");
25 			j = 0;
26 		}
27 	}
28 	putchar('\n');
29 	(void)fflush(stdout);
30 }
31