1 /* $NetBSD: printbuf.c,v 1.1.1.1 2012/03/23 21:20:09 christos Exp $ */ 2 3 /* 4 * Copyright (C) 2009 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, c; 22 int i; 23 24 for (s = buf, i = len; i; i--) { 25 c = *s++; 26 if (ISPRINT(c)) 27 putchar(c); 28 else 29 PRINTF("\\%03o", c); 30 if ((c == '\0') && zend) 31 break; 32 } 33 } 34