1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

Add a new flag '-c' to disable repeated line compression when the output

is a pipe to another program, or, if specified twice, in all cases.

PR:	bin/32420
This commit is contained in:
Archie Cobbs 2002-01-05 07:34:52 +00:00
parent 8e65260a43
commit 3a0ac99551
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=88897
2 changed files with 13 additions and 2 deletions

View File

@ -156,6 +156,12 @@ option is also specified.
Specify one specific IP address or hostname to bind to.
If a hostname is specified,
the IPv4 or IPv6 address which corresponds to it is used.
.It Fl c
Disable the compression of repeated instances of the same line
into a single line of the form
.Dq last message repeated N times
when the output is a pipe to another program.
If specified twice, disable this compression in all cases.
.It Fl d
Put
.Nm

View File

@ -274,6 +274,7 @@ int family = PF_INET; /* protocol family (IPv4 only) */
#endif
int send_to_all = 0; /* send message to all IPv4/IPv6 addresses */
int use_bootfile = 0; /* log entire bootfile for every kern msg */
int no_compress = 0; /* don't compress messages (1=pipes, 2=all) */
char bootfile[MAXLINE+1]; /* booted kernel file */
@ -334,7 +335,7 @@ main(argc, argv)
socklen_t len;
bindhostname = NULL;
while ((ch = getopt(argc, argv, "46Aa:b:df:kl:m:nop:P:suv")) != -1)
while ((ch = getopt(argc, argv, "46Aa:b:cdf:kl:m:nop:P:suv")) != -1)
switch (ch) {
case '4':
family = PF_INET;
@ -354,6 +355,9 @@ main(argc, argv)
case 'b':
bindhostname = optarg;
break;
case 'c':
no_compress++;
break;
case 'd': /* debug */
Debug++;
break;
@ -865,7 +869,8 @@ logmsg(pri, msg, from, flags)
/*
* suppress duplicate lines to this file
*/
if ((flags & MARK) == 0 && msglen == f->f_prevlen &&
if (no_compress - (f->f_type != F_PIPE) < 1 &&
(flags & MARK) == 0 && msglen == f->f_prevlen &&
!strcmp(msg, f->f_prevline) &&
!strcasecmp(from, f->f_prevhost)) {
(void)strlcpy(f->f_lasttime, timestamp, 16);