From 6202ef45da37f26d9b374e5b34bc5a899993946e Mon Sep 17 00:00:00 2001 From: epg <> Date: Fri, 30 Aug 2002 06:40:36 +0000 Subject: [PATCH] (getfiles): Move definition of this function higher up, just below store_message, since store_message is about to be calling (indirectly) calling it. --- minc | 56 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/minc b/minc index d74a5f1..36bf78e 100755 --- 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; -} - ############################################################################### # Spam handling -- 2.56.0