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