]> diplodocus.org Git - minc/commitdiff
Add new -m option to stop processing after a certain number of messages.
authorepg <>
Sat, 3 Apr 2004 06:30:55 +0000 (06:30 +0000)
committerepg <>
Sat, 3 Apr 2004 06:30:55 +0000 (06:30 +0000)
minc

diff --git a/minc b/minc
index 8187a74..69855f9 100755 (executable)
--- a/minc
+++ b/minc
@@ -8,7 +8,7 @@ B<minc> - Incorporate mail from a maildir into mh folders.
 
 =head1 SYNOPSIS
 
-B<minc> [-B<dnp>]
+B<minc> [-B<dmnp>]
 
 =head1 DESCRIPTION
 
@@ -60,6 +60,10 @@ for testing the syntax of .mincfilter.
 
 Show help.
 
+=item B<-m> I<MAX>
+
+Stop processing after I<MAX> messages.
+
 =item B<-n>
 
 Dry run; do not actually incorporate the mail, but log and report to
@@ -76,12 +80,13 @@ problem.
 =cut
 
 my $dumpfilters = 0;
+my $maxmsgs;
 our $run = 1;
 my $printfilenames = 0;
 
 my %opts;
 
-if (not getopts('dnp', \%opts)) {
+if (not getopts('dm:np', \%opts)) {
     exit(2);
 }
 
@@ -91,6 +96,10 @@ if ($opts{'d'}) {
     $run = 0;
 }
 
+if (defined($opts{'m'})) {
+    $maxmsgs = $opts{'m'};
+}
+
 if ($opts{'p'}) {
     $printfilenames = 1;
 }
@@ -607,6 +616,8 @@ sub filter_mail {
 
         printf('%6d SPAM %6d saved %6d/%1d',
                $spam, $saved, $spam + $saved, $msgcount);
+
+        $spam + $saved < $maxmsgs or last;
     }
     print("\n");