]> diplodocus.org Git - minc/commitdiff
Add new -f option, for only running filters.
authorepg <>
Sun, 1 Sep 2002 06:03:25 +0000 (06:03 +0000)
committerepg <>
Sun, 1 Sep 2002 06:03:25 +0000 (06:03 +0000)
minc

diff --git a/minc b/minc
index a572cfe..fb89834 100755 (executable)
--- a/minc
+++ b/minc
@@ -46,6 +46,10 @@ use POSIX qw(strftime WEXITSTATUS WIFEXITED);
 Dump (using Data::Dumper) the FILTERS hash and exit.  This is useful
 for testing the syntax of .mincfilter.
 
+=item B<-f>
+
+Filter only, then exit.  This is useful after running B<minc -s>.
+
 =item B<-h>
 
 Show help.
@@ -65,10 +69,12 @@ maildir.
 =cut
 
 my $dumpfilters = 0;
+my $filteronly = 0;
 my $run = 1;
 my $spamonly = 0;
 
 our $opt_d;
+our $opt_f;
 our $opt_h;
 our $opt_n;
 our $opt_s;                     # ;; # stupid cperl-mode
@@ -86,7 +92,9 @@ if ($opt_d) {
     $run = 0;
 }
 
-if ($opt_s) {                   # ))){ # stupid cperl-mode
+if ($opt_f) {
+    $filteronly = 1;
+} elsif ($opt_s) {              # ))){ # stupid cperl-mode
     $spamonly = 1;
 }
 
@@ -583,7 +591,11 @@ MAIN: {
         exit(&EX_OK);
     }
 
-    @msglist = kill_spam(getfiles("$MAILDIR/new"));
+    @msglist = getfiles("$MAILDIR/new");
+
+    if (not $filteronly) {
+        @msglist = kill_spam(@msglist);
+    }
 
     if (not $spamonly) {
         filter_mail(@msglist);