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