Home | History | Annotate | Line # | Download | only in lib
      1 /*	$NetBSD: printsbuf.c,v 1.2 2012/07/22 14:27:37 darrenr Exp $	*/
      2 
      3 /*
      4  * Copyright (C) 2012 by Darren Reed.
      5  *
      6  * See the IPFILTER.LICENCE file for details on licencing.
      7  *
      8  * Id: printsbuf.c,v 1.1.1.2 2012/07/22 13:44:42 darrenr Exp $
      9  */
     10 
     11 #ifdef	IPFILTER_SCAN
     12 
     13 #include <ctype.h>
     14 #include <stdio.h>
     15 #include "ipf.h"
     16 #include "netinet/ip_scan.h"
     17 
     18 void
     19 printsbuf(buf)
     20 	char *buf;
     21 {
     22 	u_char *s;
     23 	int i;
     24 
     25 	for (s = (u_char *)buf, i = ISC_TLEN; i; i--, s++) {
     26 		if (ISPRINT(*s))
     27 			putchar(*s);
     28 		else
     29 			PRINTF("\\%o", *s);
     30 	}
     31 }
     32 #else
     33 void printsbuf(char *buf);
     34 
     35 void printsbuf(buf)
     36 	char *buf;
     37 {
     38 	buf = buf;	/* gcc -Wextra */
     39 }
     40 #endif
     41