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