1*13885a66Sdarrenr /* $NetBSD: binprint.c,v 1.2 2012/07/22 14:27:36 darrenr Exp $ */ 2bc4097aaSchristos 3bc4097aaSchristos /* 4c9d5dc6cSdarrenr * Copyright (C) 2012 by Darren Reed. 5bc4097aaSchristos * 6bc4097aaSchristos * See the IPFILTER.LICENCE file for details on licencing. 7bc4097aaSchristos * 8*13885a66Sdarrenr * Id: binprint.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ 9bc4097aaSchristos */ 10bc4097aaSchristos 11bc4097aaSchristos #include "ipf.h" 12bc4097aaSchristos 13bc4097aaSchristos binprint(ptr,size)14bc4097aaSchristosvoid binprint(ptr, size) 15bc4097aaSchristos void *ptr; 16bc4097aaSchristos size_t size; 17bc4097aaSchristos { 18bc4097aaSchristos u_char *s; 19bc4097aaSchristos int i, j; 20bc4097aaSchristos 21bc4097aaSchristos for (i = size, j = 0, s = (u_char *)ptr; i; i--, s++) { 22bc4097aaSchristos j++; 23bc4097aaSchristos printf("%02x ", *s); 24bc4097aaSchristos if (j == 16) { 25bc4097aaSchristos printf("\n"); 26bc4097aaSchristos j = 0; 27bc4097aaSchristos } 28bc4097aaSchristos } 29bc4097aaSchristos putchar('\n'); 30bc4097aaSchristos (void)fflush(stdout); 31bc4097aaSchristos } 32