xref: /freebsd/sbin/ipf/libipf/binprint.c (revision 2a63c3be158216222d89a073dcbd6a72ee4aab5a)
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
binprint(void * ptr,size_t size)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