xref: /onnv-gate/usr/src/cmd/ipf/lib/common/printlog.c (revision 0:68f95e015346)
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: printlog.c,v 1.6 2002/01/28 06:50:47 darrenr Exp $
7*0Sstevel@tonic-gate  */
8*0Sstevel@tonic-gate 
9*0Sstevel@tonic-gate #include "ipf.h"
10*0Sstevel@tonic-gate 
11*0Sstevel@tonic-gate #include <syslog.h>
12*0Sstevel@tonic-gate 
13*0Sstevel@tonic-gate 
printlog(fp)14*0Sstevel@tonic-gate void printlog(fp)
15*0Sstevel@tonic-gate frentry_t *fp;
16*0Sstevel@tonic-gate {
17*0Sstevel@tonic-gate 	char *s, *u;
18*0Sstevel@tonic-gate 
19*0Sstevel@tonic-gate 	printf("log");
20*0Sstevel@tonic-gate 	if (fp->fr_flags & FR_LOGBODY)
21*0Sstevel@tonic-gate 		printf(" body");
22*0Sstevel@tonic-gate 	if (fp->fr_flags & FR_LOGFIRST)
23*0Sstevel@tonic-gate 		printf(" first");
24*0Sstevel@tonic-gate 	if (fp->fr_flags & FR_LOGORBLOCK)
25*0Sstevel@tonic-gate 		printf(" or-block");
26*0Sstevel@tonic-gate 	if (fp->fr_loglevel != 0xffff) {
27*0Sstevel@tonic-gate 		printf(" level ");
28*0Sstevel@tonic-gate 		if (fp->fr_loglevel & LOG_FACMASK) {
29*0Sstevel@tonic-gate 			s = fac_toname(fp->fr_loglevel);
30*0Sstevel@tonic-gate 			if (s == NULL)
31*0Sstevel@tonic-gate 				s = "!!!";
32*0Sstevel@tonic-gate 		} else
33*0Sstevel@tonic-gate 			s = "";
34*0Sstevel@tonic-gate 		u = pri_toname(fp->fr_loglevel);
35*0Sstevel@tonic-gate 		if (u == NULL)
36*0Sstevel@tonic-gate 			u = "!!!";
37*0Sstevel@tonic-gate 		if (*s)
38*0Sstevel@tonic-gate 			printf("%s.%s", s, u);
39*0Sstevel@tonic-gate 		else
40*0Sstevel@tonic-gate 			printf("%s", u);
41*0Sstevel@tonic-gate 	}
42*0Sstevel@tonic-gate }
43