procmail
[Top] [All Lists]

Re: Procmail patch to avoid growing humungous log files with VERBOSE=on

1997-08-13 11:26:00
Bradley Ward Allen wrote,

| I'm sorry, I should have sent the list a fresh copy of the patch
| without the quoting.  I attach it here, as a MIME part, uuencoded,
| just to be sure. It was correct, just a bit quoted and PGP signed
| and everything, it was a mess.  Now anybody should be able to decode it.

Actually, it could be sent in plain text and not need to be decoded at all;
why Bradley uuencoded it is beyond me.  I'll include the plain text below.

Question, though: how is it used?  I get the feeling that VERBOSEMATCH and
VERBOSEMATCHONLY are Booleans, but what *exactly* do they do?  (I can make
guesses, but I don't want to rely on guesswork.)  There was talk of a func-
tion to make the log verbose only for reporting matches and not for reporting
"No match", but surely that feature would require only one new variable;
there are two introduced here.

DWT

diff -Nru procmail-3.11pre7/src/misc.c procmail-3.11pre7+ulmo/src/misc.c
--- procmail-3.11pre7/src/misc.c        Sun Apr 27 20:27:46 1997
+++ procmail-3.11pre7+ulmo/src/misc.c   Mon Aug  4 14:30:07 1997
@@ -31,7 +31,8 @@
 struct varval strenvvar[]={{"LOCKSLEEP",DEFlocksleep},
  {"LOCKTIMEOUT",DEFlocktimeout},{"SUSPEND",DEFsuspend},
  {"NORESRETRY",DEFnoresretry},{"TIMEOUT",DEFtimeout},{"VERBOSE",DEFverbose},
- {"LOGABSTRACT",DEFlogabstract}};
+ {"LOGABSTRACT",DEFlogabstract},
+ {"VERBOSEMATCH",DEFverbosematch},{"VERBOSEMATCHONLY",DEFverbosematchonly}};
 struct varstr strenstr[]={{"SHELLMETAS",DEFshellmetas},{"LOCKEXT",DEFlockext},
  {"MSGPREFIX",DEFmsgprefix},{"COMSAT",""},{"TRAP",""},
  {"SHELLFLAGS",DEFshellflags},{"DEFAULT",DEFdefault},{"SENDMAIL",DEFsendmail},
@@ -948,7 +949,7 @@
 plusinfty:  score=MAX32;
         if(score<=MIN32)                      /* chop off at minus infinity */
 mininfty:   score=MIN32,i=0;
-        if(verbose)
+         if((i&&verbosematch) || (verbose && (!i==!verbosematchonly)))
          { if(scoreany)             /* not entirely correct, but it will do */
             { charNUM(num,long);
               nlog("Score: ");ltstr(7,(long)(score-lscore),num);
diff -Nru procmail-3.11pre7/src/procmail.c procmail-3.11pre7+ulmo/src/procmail.c
--- procmail-3.11pre7/src/procmail.c    Sun Apr 27 20:27:48 1997
+++ procmail-3.11pre7+ulmo/src/procmail.c       Mon Aug  4 13:50:54 1997
@@ -505,6 +505,7 @@
 #if !DEFverbose
           if(rcstate!=rc_NORMAL)
              verbose=0;                    /* no peeking in /etc/procmailrc */
+           /* need something here for verbosematch? */
 #endif
           goto startrc;
         }
diff -Nru procmail-3.11pre7/src/procmail.h procmail-3.11pre7+ulmo/src/procmail.h
--- procmail-3.11pre7/src/procmail.h    Tue Apr  1 22:15:45 1997
+++ procmail-3.11pre7+ulmo/src/procmail.h       Mon Aug  4 13:45:55 1997
@@ -7,6 +7,8 @@
 #else
 #define DEFverbose 0
 #endif
+#define DEFverbosematch 0
+#define DEFverbosematchonly 0
 
 #ifndef DEFsendmail
 #define DEFsendmail SENDMAIL
@@ -54,6 +56,8 @@
 #define noresretry     (strenvvar[3].val)
 #define timeoutv       (strenvvar[4].val)
 #define verbose                (*(volatile long*)&strenvvar[5].val)
+#define verbosematch   (*(volatile long*)&strenvvar[7].val)
+#define verbosematchonly (*(volatile long*)&strenvvar[8].val)
 #define lgabstract     (strenvvar[6].val)
 
 extern struct varstr{const char*const sname,*sval;}strenstr[];