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