10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * Copyright (C) 1993-2001 by Darren Reed.
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * See the IPFILTER.LICENCE file for details on licencing.
50Sstevel@tonic-gate *
6*2393Syz155240 * $Id: printbuf.c,v 1.5.4.1 2004/12/09 19:41:22 darrenr Exp $
70Sstevel@tonic-gate */
80Sstevel@tonic-gate
90Sstevel@tonic-gate #include <ctype.h>
100Sstevel@tonic-gate
110Sstevel@tonic-gate #include "ipf.h"
120Sstevel@tonic-gate
130Sstevel@tonic-gate
printbuf(buf,len,zend)140Sstevel@tonic-gate void printbuf(buf, len, zend)
150Sstevel@tonic-gate char *buf;
160Sstevel@tonic-gate int len, zend;
170Sstevel@tonic-gate {
180Sstevel@tonic-gate char *s, c;
190Sstevel@tonic-gate int i;
200Sstevel@tonic-gate
210Sstevel@tonic-gate for (s = buf, i = len; i; i--) {
220Sstevel@tonic-gate c = *s++;
23*2393Syz155240 if (ISPRINT(c))
240Sstevel@tonic-gate putchar(c);
250Sstevel@tonic-gate else
260Sstevel@tonic-gate printf("\\%03o", c);
270Sstevel@tonic-gate if ((c == '\0') && zend)
280Sstevel@tonic-gate break;
290Sstevel@tonic-gate }
300Sstevel@tonic-gate }
31