]> diplodocus.org Git - minc/commitdiff
Improve 'die' usage and leave an XXX comment in store_message about
authorepg <>
Sun, 25 Apr 2004 22:02:47 +0000 (22:02 +0000)
committerepg <>
Sun, 25 Apr 2004 22:02:47 +0000 (22:02 +0000)
same.

minc

diff --git a/minc b/minc
index f4e7d01..cbbe6a0 100755 (executable)
--- a/minc
+++ b/minc
@@ -262,7 +262,7 @@ sub getfiles {
     my @result;
 
     if (not opendir(DIR, $dir)) {
-        die("Failed opendir($dir)");
+        die("opendir($dir): $!");
     }
 
     # Initialize $! to 0 (success) because stupid stupid Perl provides
@@ -277,7 +277,7 @@ sub getfiles {
       } readdir(DIR);
 
     if ($! != 0) {
-        die("Failed readdir($dir)");
+        die("readdir($dir): $!");
     }
 
     if (@result == 0) {
@@ -301,14 +301,14 @@ sub get_highest_msgnum {
 
     $dir = "$mh/$mhfolder";
     if (not opendir(DIR, $dir)) {
-        die("Failed opendir($dir)");
+        die("opendir($dir): $!");
     }
 
     $! = 0;
     @list = readdir(DIR);
 
     if ($! != 0) {
-        die("Failed readdir($dir)");
+        die("readdir($dir): $!");
     }
 
     closedir(DIR);
@@ -392,7 +392,7 @@ sub store_message {
 
     if ($run) {
         if (not rename($msg, $mhmsg)) {
-            die("Failed rename($msg, $mhmsg)");
+            die("rename($msg, $mhmsg): $!");
         }
 
         # Mark each message as soon as we store it and bomb if that
@@ -404,6 +404,8 @@ sub store_message {
         } else {
             $status = system('mark', "+$mhfolder", "$msgnum", '-sequence',
                              'unseen', '-add');
+            # XXX need to handle signalled and stopped, and print
+            # the exit code or signal number.
             if (not WIFEXITED($status)) {
                 die("Failed to run mark");
             } elsif (WEXITSTATUS($status) != 0) {