xref: /titanic_50/usr/src/cmd/ipf/lib/common/printlog.c (revision c77a61a72b5ecdc507d6cf104142edd371a16c84)
1 /*
2  * Copyright (C) 1993-2001 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * $Id: printlog.c,v 1.6 2002/01/28 06:50:47 darrenr Exp $
7  */
8 
9 #include "ipf.h"
10 
11 #include <syslog.h>
12 
13 
14 void printlog(fp)
15 frentry_t *fp;
16 {
17 	char *s, *u;
18 
19 	printf("log");
20 	if (fp->fr_flags & FR_LOGBODY)
21 		printf(" body");
22 	if (fp->fr_flags & FR_LOGFIRST)
23 		printf(" first");
24 	if (fp->fr_flags & FR_LOGORBLOCK)
25 		printf(" or-block");
26 	if (fp->fr_loglevel != 0xffff) {
27 		printf(" level ");
28 		if (fp->fr_loglevel & LOG_FACMASK) {
29 			s = fac_toname(fp->fr_loglevel);
30 			if (s == NULL)
31 				s = "!!!";
32 		} else
33 			s = "";
34 		u = pri_toname(fp->fr_loglevel);
35 		if (u == NULL)
36 			u = "!!!";
37 		if (*s)
38 			printf("%s.%s", s, u);
39 		else
40 			printf("%s", u);
41 	}
42 }
43