]> diplodocus.org Git - minc/commitdiff
(preprocess): Return the @result list sorted by mtime.
authorepg <>
Fri, 12 Mar 2004 03:44:18 +0000 (03:44 +0000)
committerepg <>
Fri, 12 Mar 2004 03:44:18 +0000 (03:44 +0000)
minc

diff --git a/minc b/minc
index 9f006ef..87a7813 100755 (executable)
--- a/minc
+++ b/minc
@@ -33,6 +33,7 @@ use Errno;
 use Fcntl qw(O_WRONLY O_EXCL O_CREAT);
 use FileHandle;
 use File::Basename;
+use File::stat;
 use Getopt::Std;
 use Log::Dispatch;
 use Log::Dispatch::File;
@@ -575,6 +576,7 @@ sub preprocess {
     my @baton;
     my $msg;
     my $i;
+    my $st;
     my @result;
 
     @baton = spam_start_hook();
@@ -596,7 +598,15 @@ sub preprocess {
 
     spam_stop_hook(@baton);
 
-    return @result;
+    return (map { $_->[1] }
+            sort { $a->[0] <=> $b->[0] }
+            map {
+                if (not ($st = stat($_))) {
+                    die("stat($_): $!");
+                }
+                [$st->mtime, $_]
+            }
+            @result);
 }
 
 \f