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