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 <ctype.h> 12 13 #include "ipf.h" 14 15 16 void 17 printbuf(buf, len, zend) 18 char *buf; 19 int len, zend; 20 { 21 char *s; 22 int c; 23 int i; 24 25 for (s = buf, i = len; i; i--) { 26 c = *s++; 27 if (isprint(c)) 28 putchar(c); 29 else 30 PRINTF("\\%03o", c); 31 if ((c == '\0') && zend) 32 break; 33 } 34 } 35