printbuf.c revision 145510
1/* $NetBSD$ */ 2 3/* 4 * Copyright (C) 1993-2001 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 * 8 * Id: printbuf.c,v 1.5.4.1 2004/12/09 19:41:22 darrenr Exp 9 */ 10 11#include <ctype.h> 12 13#include "ipf.h" 14 15 16void printbuf(buf, len, zend) 17char *buf; 18int len, zend; 19{ 20 char *s, c; 21 int i; 22 23 for (s = buf, i = len; i; i--) { 24 c = *s++; 25 if (ISPRINT(c)) 26 putchar(c); 27 else 28 printf("\\%03o", c); 29 if ((c == '\0') && zend) 30 break; 31 } 32} 33