]> diplodocus.org Git - minc/commitdiff
(getfiles): Move definition of this function higher up, just below
authorepg <>
Fri, 30 Aug 2002 06:40:36 +0000 (06:40 +0000)
committerepg <>
Fri, 30 Aug 2002 06:40:36 +0000 (06:40 +0000)
store_message, since store_message is about to be calling (indirectly)
calling it.

minc

diff --git a/minc b/minc
index d74a5f1..36bf78e 100755 (executable)
--- a/minc
+++ b/minc
@@ -265,6 +265,34 @@ sub mkfolder {
     }
 }
 
+sub getfiles {
+    my $dir = shift;
+    my @result;
+
+    if (not opendir(DIR, $dir)) {
+        err(&EX_TEMPFAIL, "Failed opendir($dir)");
+    }
+
+    # Initialize $! to 0 (success) because stupid stupid Perl provides
+    # no way to distinguish an error from an empty directory; that
+    # means setting $! to 0 and testing it afterwards is the only way
+    # to detect an error.  Real Programmers don't handle errors,
+    # right?  >sigh<
+    $! = 0;
+    @result = grep {
+        ($_ ne '.' and $_ ne '..')
+          and $_ = "$MAILDIR/new/$_"
+      } readdir(DIR);
+
+    if ($! != 0) {
+        err(&EX_TEMPFAIL, "Failed readdir($dir)");
+    }
+
+    closedir(DIR);
+
+    return @result;
+}
+
 # We want to print the name of each list that has new mail only once,
 # so use this hash to store the lists that have already been printed.
 # Start the list out with SPAM already in it, since we don't care when
@@ -350,34 +378,6 @@ sub get_headers {
     return %headers;
 }
 
-sub getfiles {
-    my $dir = shift;
-    my @result;
-
-    if (not opendir(DIR, $dir)) {
-        err(&EX_TEMPFAIL, "Failed opendir($dir)");
-    }
-
-    # Initialize $! to 0 (success) because stupid stupid Perl provides
-    # no way to distinguish an error from an empty directory; that
-    # means setting $! to 0 and testing it afterwards is the only way
-    # to detect an error.  Real Programmers don't handle errors,
-    # right?  >sigh<
-    $! = 0;
-    @result = grep {
-        ($_ ne '.' and $_ ne '..')
-          and $_ = "$MAILDIR/new/$_"
-      } readdir(DIR);
-
-    if ($! != 0) {
-        err(&EX_TEMPFAIL, "Failed readdir($dir)");
-    }
-
-    closedir(DIR);
-
-    return @result;
-}
-
 \f
 ###############################################################################
 # Spam handling