Import colortail 0.3.0, submitted by Robert Nagy <thuglife@bsd.hu>.

Colortail works like standard tail(1) but it can optionally read
one or more configuration files that specify which patterns result
in which colors.  It can be used to quickly get an overview of
interesting activity, e.g. by colorizing keywords bright red or
some other color of your choice.
This commit is contained in:
naddy 2004-02-26 00:30:05 +00:00
parent 8edb391ee5
commit 4a5218dd88
10 changed files with 271 additions and 0 deletions

View File

@ -0,0 +1,26 @@
# $OpenBSD: Makefile,v 1.1.1.1 2004/02/26 00:30:05 naddy Exp $
COMMENT= "color-able replacement for tail(1)"
DISTNAME= colortail-0.3.0
CATEGORIES= sysutils
HOMEPAGE= http://www.student.hk-r.se/~pt98jan/colortail.html
MASTER_SITES= http://www.student.hk-r.se/~pt98jan/
MAINTAINER= Robert Nagy <thuglife@bsd.hu>
# GPL
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
CONFIGURE_STYLE= gnu
post-install:
${INSTALL_MAN} ${FILESDIR}/colortail.1 ${PREFIX}/man/man1
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/colortail
${INSTALL_DATA} ${WRKSRC}/example-conf/conf* \
${PREFIX}/share/examples/colortail
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
MD5 (colortail-0.3.0.tar.gz) = 2589d3e372080f4052d1cc0d6550508f
RMD160 (colortail-0.3.0.tar.gz) = 9141fff0a26ec653b39f580749336cbd16c92492
SHA1 (colortail-0.3.0.tar.gz) = 5c55a9b0550868129d8ede133f6b34fa5356c5ce

View File

@ -0,0 +1,93 @@
.\" $OpenBSD: colortail.1,v 1.1.1.1 2004/02/26 00:30:05 naddy Exp $
.\" $NetBSD: patch-ac,v 1.1 2002/12/13 23:01:43 jschauma Exp $
.TH COLORTAIL 1 "August 02, 2001" "System Utilities" colortail
.SH NAME
colortail \- output the last part of files, optionally with color
.SH SYNOPSIS
.B colortail
[\fIOPTION\fR]... [\fIFILE\fR]...
.SH DESCRIPTION
Print last 10 lines of each FILE to standard output.
With more than one FILE, precede each with a header giving the file name.
\fBcolortail\fR works like tail but can optionally read one or more config files
where it's specified which patterns results in which colors.
\fBcolortail\fR uses regular expressions (see \fIre_format(7)\fR) to determine
which lines and parts of lines to print in which colors.
.SH USAGE
Most options are easily understandood. The only somewhat strange option is the
\fI-k\fR option that specifies the config files so \fBcolortail\fR knows what
should be printed in which color.
If only one config file and one or more tail files is given the config file
is treated as a global one, i.e.
\fBcolortail\fR \fI-k\fR conf.global file1 file2 file3
Multiple config files are separated with a , and if one tail file shouldn't
have a config file just leave it blank, i.e.
\fBcolortail\fR \fI-k\fR conf.file1,,conf.file3 file1 file2 file3
.SH OPTIONS
This program follow the usual GNU command line syntax, with long options
starting with two dashes (`--'). A summary of options is included below.
.TP
.B \-f, \-\-follow
output appended data as the file grows
.TP
.B \-h, \-\-help
Show summary of options.
.TP
.B \-k, \-\-config=file, \-\-config=file1,file2,...
color config files for the tail files. If only one config file it's global
otherwise one config file for each tail file
.TP
\fB\-n, \-\-lines=\fR\fIN\fR
output the last \fIN\fR lines, instead of last 10
.TP
.TP
.B \-v, \-\-version
output version information and exit
.SH FILE FORMAT
The file specified by the \fI-k\fR option tells colortail how to display the
output according to regular expressions. The file mapps one or more regular
expressions to one of the following colors: brightblue, brightred,
brightwhite, blue, cyan, green, magenta, yellow. Comments start with a "#":
COLOR brightred
.br
{
.br
# matches the word "root"
.br
^.*(root).*$
.br
}
.br
.SH VERSION
0.3.0
.SH BUGS
Under certain circumstances \fBcolortail\fR may miss some characters when
tailing forever. This bug also exists in \fItail(1)\fR. If you have found a
bug, please send a mail to pt98jan@student.hk-r.se
.SH SEE ALSO
.BR re_format (7),
.BR tail (1)
.SH AUTHOR
.nr
Joakim Andersson <pt98jan@student.hk-r.se> - colortail
.br
Jan Schaumann <jschauma@netmeister.org> - this man page

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-CfgFileParser_cc,v 1.1.1.1 2004/02/26 00:30:05 naddy Exp $
--- CfgFileParser.cc.orig 2004-02-26 00:03:08.000000000 +0100
+++ CfgFileParser.cc 2004-02-26 00:03:25.000000000 +0100
@@ -20,10 +20,10 @@
#include "CfgFileParser.h"
#include <stdio.h>
-#include <fstream.h>
+#include <iostream.h>
#include <assert.h>
#include <string.h>
-#include <malloc.h>
+#include <stdlib.h>
// ## class SearchData ##

View File

@ -0,0 +1,54 @@
$OpenBSD: patch-Colorizer_cc,v 1.1.1.1 2004/02/26 00:30:05 naddy Exp $
--- Colorizer.cc.orig 2004-01-11 16:15:16.000000000 -0500
+++ Colorizer.cc 2004-01-11 16:15:46.000000000 -0500
@@ -23,7 +23,7 @@
#include <assert.h>
#include <stdio.h>
-#include <strstream.h>
+#include <strstream>
Colorizer::Colorizer()
@@ -111,7 +111,7 @@
ListIterator<SearchData*> itr(*m_items_list);
// will contain the new string
- ostrstream newstr;
+ std::ostrstream newstr;
SearchData *current;
int i = 0;
@@ -172,7 +172,7 @@
}
// write ansi reset str and a newline
- newstr << ANSI_RESET_STR << endl << ends;
+ newstr << ANSI_RESET_STR << std::endl << std::ends;
// return the new string
return newstr.str();
}
@@ -187,12 +187,12 @@
// check if str ends in '\n'
if (str[strlen(str)] == '\n')
{
- newstr << str << ends;
+ newstr << str << std::ends;
}
else
{
// doesn't end in '\n'
- newstr << str << endl << ends;
+ newstr << str << std::endl << std::ends;
}
// return the new string
@@ -240,7 +240,7 @@
// write newline and null
//newstr << endl << ends;
- newstr << ends;
+ newstr << std::ends;
// return the new string

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-OptionsParser_cc,v 1.1.1.1 2004/02/26 00:30:05 naddy Exp $
--- OptionsParser.cc.orig 2004-01-11 16:15:24.000000000 -0500
+++ OptionsParser.cc 2004-01-11 16:15:42.000000000 -0500
@@ -18,7 +18,7 @@
*/
#include <iostream.h>
-#include <strstream.h>
+#include <strstream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -130,7 +130,7 @@
int loop = 1;
while (loop)
{
- ostrstream filename;
+ std::ostrstream filename;
while (1)
{

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-TailFile_cc,v 1.1.1.1 2004/02/26 00:30:05 naddy Exp $
--- TailFile.cc.orig 2004-01-11 16:19:14.000000000 -0500
+++ TailFile.cc 2004-01-11 16:20:33.000000000 -0500
@@ -375,7 +375,7 @@
// check if there isn't a follow buffer
if (m_follow_buffer == NULL)
{
- m_follow_buffer = new ostrstream();
+ m_follow_buffer = new std::ostrstream();
}
// make buffer
@@ -417,6 +417,9 @@
int ch = fgetc(m_file);
// add the character to the string
+ if (ch == EOF)
+ clearerr(m_file); // required by POSIX and ANSI
+ else
m_follow_buffer->put(ch);
// check if return

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-TailFile_h,v 1.1.1.1 2004/02/26 00:30:05 naddy Exp $
--- TailFile.h.orig 2004-01-11 16:15:51.000000000 -0500
+++ TailFile.h 2004-01-11 16:15:55.000000000 -0500
@@ -23,7 +23,8 @@
#include "Colorizer.h"
#include <stdio.h>
-#include <strstream.h>
+#include <iostream>
+#include <strstream>
#define MAX_CHARS_READ 1024
@@ -40,7 +41,7 @@
// the stream position
long m_position;
// the follow buffer, used in follow_print
- ostrstream *m_follow_buffer;
+ std::ostrstream *m_follow_buffer;
// private methods
void find_position(int n);

View File

@ -0,0 +1,5 @@
Colortail works like standard tail(1) but it can optionally read
one or more configuration files that specify which patterns result
in which colors. It can be used to quickly get an overview of
interesting activity, e.g. by colorizing keywords bright red or
some other color of your choice.

View File

@ -0,0 +1,9 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2004/02/26 00:30:05 naddy Exp $
bin/colortail
man/man1/colortail.1
share/examples/colortail/conf.daemon
share/examples/colortail/conf.kernel
share/examples/colortail/conf.messages
share/examples/colortail/conf.secure
share/examples/colortail/conf.xferlog
@dirrm share/examples/colortail