xref: /illumos-gate/usr/src/cmd/ipf/lib/common/binprint.c (revision 7c478bd9)
1 /*
2  * Copyright (C) 1993-2001 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * $Id: binprint.c,v 1.8 2002/05/14 15:18:56 darrenr Exp $
7  */
8 
9 #include "ipf.h"
10 
11 
binprint(ptr,size)12 void binprint(ptr, size)
13 void *ptr;
14 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