On Sun, Jan 16, 2005 at 02:09:16PM -0500, Stephen Gran said: > Hello all, > > I have asked for this before, I think, but it would be really nice if > output from the various clam binaries went to different file desriptors, > depending on whether they are errors, warnings, or informative. This > would more easily filtering of output in things like cron jobs and the > like. I believe the attached patch does so.
I think this patch is maybe a little smarter: -- -------------------------------------------------------------------------- | Stephen Gran | fortune: cpu time/usefulness ratio too | | [EMAIL PROTECTED] | high -- core dumped. | | http://www.lobefin.net/~steve | | --------------------------------------------------------------------------
--- clamav-devel-latest/shared/output.c 2004-10-16 20:48:02.000000000 -0400 +++ output.c 2005-01-16 18:33:13.000000000 -0500 @@ -240,10 +240,7 @@ return; } - if(mprintf_stdout) - fd = stdout; - else - fd = stderr; + fd = stdout; /* legend: * ! - error @@ -253,11 +250,11 @@ /* * ERROR WARNING STANDARD - * normal yes yes yes + * normal stderr stderr stdout * - * verbose yes yes yes + * verbose stderr stderr stdout * - * quiet yes no no + * quiet stderr no no */ @@ -266,9 +263,13 @@ va_start(argscpy, str); if(*str == '!') { + if(!mprintf_stdout) + fd = stderr; fprintf(fd, "ERROR: "); vfprintf(fd, ++str, args); } else if(*str == '@') { + if(!mprintf_stdout) + fd = stderr; fprintf(fd, "ERROR: "); vfprintf(fd, ++str, args); #ifdef NO_SNPRINTF @@ -279,6 +280,8 @@ logg("ERROR: %s", logbuf); } else if(!mprintf_quiet) { if(*str == '^') { + if(!mprintf_stdout) + fd = stderr; fprintf(fd, "WARNING: "); vfprintf(fd, ++str, args); } else if(*str == '*') {
pgpYfYCoziN5z.pgp
Description: PGP signature
_______________________________________________ http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-devel