]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/ipfilter/lib/printbuf.c
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / ipfilter / lib / printbuf.c
1 /*      $FreeBSD$       */
2
3 /*
4  * Copyright (C) 2000-2004 by Darren Reed.
5  *
6  * See the IPFILTER.LICENCE file for details on licencing.
7  *
8  * $Id: printbuf.c,v 1.5.4.2 2006/06/16 17:21:10 darrenr Exp $
9  */
10
11 #include <ctype.h>
12
13 #include "ipf.h"
14
15
16 void printbuf(buf, len, zend)
17 char *buf;
18 int 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 }