printbuf.c revision 145510
1145510Sdarrenr/* $NetBSD$ */ 2145510Sdarrenr 3145510Sdarrenr/* 4145510Sdarrenr * Copyright (C) 1993-2001 by Darren Reed. 5145510Sdarrenr * 6145510Sdarrenr * See the IPFILTER.LICENCE file for details on licencing. 7145510Sdarrenr * 8145510Sdarrenr * Id: printbuf.c,v 1.5.4.1 2004/12/09 19:41:22 darrenr Exp 9145510Sdarrenr */ 10145510Sdarrenr 11145510Sdarrenr#include <ctype.h> 12145510Sdarrenr 13145510Sdarrenr#include "ipf.h" 14145510Sdarrenr 15145510Sdarrenr 16145510Sdarrenrvoid printbuf(buf, len, zend) 17145510Sdarrenrchar *buf; 18145510Sdarrenrint len, zend; 19145510Sdarrenr{ 20145510Sdarrenr char *s, c; 21145510Sdarrenr int i; 22145510Sdarrenr 23145510Sdarrenr for (s = buf, i = len; i; i--) { 24145510Sdarrenr c = *s++; 25145510Sdarrenr if (ISPRINT(c)) 26145510Sdarrenr putchar(c); 27145510Sdarrenr else 28145510Sdarrenr printf("\\%03o", c); 29145510Sdarrenr if ((c == '\0') && zend) 30145510Sdarrenr break; 31145510Sdarrenr } 32145510Sdarrenr} 33