--- ltp	Sat May 11 22:37:07 2002
+++ ltp-0.2	Sat May 11 22:32:39 2002
@@ -75,7 +75,8 @@
     return %projects;
 }
 
-# This sub lists all suplies for 
+# This sub lists all suplies needed for the projects
+
 sub supplies
 {
     my $query;
@@ -111,6 +112,10 @@
     }
 }
 
+
+#lists projects and boothnumbers
+#if --onlybooth only projects with an existing booth are listed
+
 sub list
 {
     my $query = "SELECT name,boothnr FROM project ";
@@ -122,14 +127,17 @@
     $query .= " WHERE boothnr <> ''" if ($opt_onlybooth);
     $query .= " ORDER BY name";
 
-    $sth = $dbh->prepare($query);
-    if ($sth && ($rc = $sth->execute) > 0) {
+    $sth = $dbh->prepare($query) or die "Cannot prepare Query: $DBI::errstr\n";
+    $sth->execute or die "Cannot execute Query: $DBI::errstr\n";
         while (@row = $sth->fetchrow_array) {
 	    printf "%2d. %-25s  %s\n", ++$nr, $row[0], $row[1];
         }
-    }
 }
 
+
+#Lists the mailadresses sorted by projects 
+#Accepts $project as parameter, then only $project is shown
+
 sub list_mails
 {
     my $onlyproject = shift;
@@ -151,8 +159,8 @@
     } else {
 	$space = "";
     }
-    $sth = $dbh->prepare($query);
-    if ($sth && ($rc = $sth->execute) > 0) {
+    $sth = $dbh->prepare($query) or die "Cannot prepare Query: $DBI::errstr\n";
+    $sth->execute or die "Cannot execute Query: $DBI::errstr\n";
         while (@row = $sth->fetchrow_array) {
 	    if ($project ne $row[0]) {
 		print "\n" if ($project);
@@ -161,7 +169,7 @@
 	    }
 	    printf "%s%s <%s>,\n", $space, $row[1], $row[2];
         }
-    }
+    
 }
 
 sub list_titles
@@ -795,7 +803,12 @@
     } elsif ($ARGV[$argc] eq "--exportlt") {
 	exportlt ();
     } elsif ($ARGV[$argc] eq "--mails") {
-	list_mails ('');
+    	#inserted for choosing specified project (Note: would be much easier with getopt)
+    	if (($argc < $#ARGV) && ($ARGV[$argc+1] !~ /^-/)) {
+		list_mails ($ARGV[++$argc]);
+	} else {
+		list_mails ('');
+	}
     } elsif ($ARGV[$argc] eq "--members") {
 	latex_members ('');
     } elsif ($ARGV[$argc] eq "--nili") {

