ra output line buffered
Philipp E. Letschert
phil at uni-koblenz.de
Sun Jan 21 04:33:27 EST 2007
Hi,
I'm currently implementing live Argus reading for ArgusEye. Because the output
is block-buffered when not writing to a terminal, reading from a pipe to
ra has delays, when there is little or no traffic recorded (or a very specific
filter is applied).
It would be nice for the GUI if new transactions could appear as soon as the ra
client prints them, but I haven't yet found a way to tell perl it should read in
line buffered mode from the pipe to ra.
Desperatedly I changed ra.c to force line-buffered mode, which solved the
problem:
*** ra.c 2006-12-11 21:30:53.000000000 +0100
--- ra.c.orig 2007-01-21 10:07:55.095654464 +0100
***************
*** 224,229 ****
--- 224,231 ----
bzero (buf, sizeof(buf));
ArgusPrintRecord(parser, buf, argus, MAXSTRLEN);
+ setvbuf (stdout, (char *)NULL, _IOLBF, 0);
+
fprintf (stdout, "%s", buf);
if (parser->eflag == ARGUS_HEXDUMP) {
It seems to work, but all implications of this change are beyond my
understanding. So this is a feature request for line-buffered output in ra,
either as a default, or via a command line switch such as --line-buffered.
Regards, Philipp
More information about the argus
mailing list