Index: trunk/tools/czartool.pl
===================================================================
--- trunk/tools/czartool.pl	(revision 27999)
+++ trunk/tools/czartool.pl	(revision 28000)
@@ -16,7 +16,6 @@
 if (!$db) {die;}
 
-my @stdscienceLabels = loadLabels("stdscience");
-my @distributionLabels = loadLabels("distribution");
-showLabelDifferences();
+my @stdscienceLabels = `getLabels.pl -s stdscience`;
+my @distributionLabels = `getLabels.pl -s distribution`;
 
 checkAllLabels("new");
@@ -54,4 +53,5 @@
         elsif ($key eq "w") {checkAllLabels("wait");}
         elsif ($key eq "l") {labelDetails();}
+        elsif ($key eq "u") {serverStatus("stdscience");}
         elsif ($key =~ m/[0-9]/) {my $key2=getc; checkOneLabel($stdscienceLabels[$key.$key2]);}
         printInstructions();
@@ -84,25 +84,4 @@
 ###########################################################################
 #
-# Display label differences between stdscience and distribution
-#
-###########################################################################
-sub showLabelDifferences {
-
-    my @diffLabels = @{getArrayDifferences(\@stdscienceLabels, \@distributionLabels)};
-
-    printf("+-------------------------------------------------------+\n");
-    printf("| Label differences between stdscience and distribution |\n");
-    printf("+-------------------------------------------------------+\n");
-
-    my $item;
-    foreach $item (@diffLabels) { 
-
-        printf( "| %53s |\n", $item);
-    }
-    printf("+-------------------------------------------------------+\n");
-}
-
-###########################################################################
-#
 # Compares two arrays and stores the differences
 #
@@ -133,29 +112,18 @@
 ###########################################################################
 #
-# Loads labels from a particular pantasks server
-#
-###########################################################################
-sub loadLabels {
+# Prints the status of a given pantasks server
+#
+###########################################################################
+sub serverStatus {
     my ($server) = @_;
 
-    my @cmdOut = `echo "show.labels;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
+    my @cmdOut = `echo "status;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
     my $line;
-    my @labels;
-    my $passedHeader=0;
     foreach $line (@cmdOut) {
 
         chomp($line);
-        if ($line =~ m/pantasks:\s+(.*)/) {
-           
-            # HACK to get around 'dummy' label in stdscience
-            if ($1 !~ m/.*dummy.*/) {push(@labels, $1);}
-            $passedHeader=1; 
-            next;
-        }
-        
-        if ($passedHeader){push(@labels, $line);}
-    }
-
-    return @labels;
+    
+        print "$line\n";
+    }
 }
 
@@ -176,23 +144,10 @@
     foreach $server (@servers) {
 
+        my @results = `checkServer.pl -s $server`;
+
         printf("| %12s ", $server);
-
-        my @cmdOut = `echo "status ;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
-
-        my $line;
-        my $foundStatus = 0;
-        my $isRunning = 0;
-        foreach $line (@cmdOut) {
-
-            chomp($line);
-            if ($line =~ m/Scheduler is stopped/) {$isRunning = 0; $foundStatus=1;last;}
-            if ($line =~ m/Scheduler is running/) {$isRunning = 1; $foundStatus=1;last;}
-            if ($line =~ m/Task Staus/) {last;}
-
-        }
-
-        if (!$foundStatus){print "|    NO   ";} else {print "|   yes   ";}
-        if (!$isRunning){print "|           NO         ";} else {print "|          yes         ";}
-        printf("|\n");
+        chomp($results[0]);
+        chomp($results[1]); 
+        printf("|   %3s   |         %3s          |\n", $results[0], $results[1]);
     }
 
@@ -263,32 +218,42 @@
 sub checkAllLabels {
     my ($state) = @_;
-
-    printf("\n+------------------------------------------------------------------------------------------------------------------------------------------------------------+\n");
-    printf("|                                                                         %10s                                                                         |\n", $state);
-    printf("+------------------------------------------------------------------------------------------------------------------------------------------------------------+\n");
-    printf("| no  |              label               |    chip   |    cam     |    fake    |    warp    |   stack    |    diff    |   magic    |  destreak  |    dist    |\n");
-    printf("+-----+----------------------------------+-----------+------------+------------+------------+------------+------------+------------+------------+------------+\n");
-
-    my $label;
+#print time, $/;
+    printf("\n+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n");
+    printf("|                                                                           %10s (any faults are shown in parentheses)                                                  |\n", $state);
+    printf("+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n");
+    printf("| no  |              label               | distributing? |    chip    |    cam     |    fake    |    warp    |   stack    |    diff    |   magic    |  destreak  |    dist    |\n");
+    printf("+-----+----------------------------------+---------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+\n");
+
+    my $stdsLabel;
+    my $distLabel;
     my $i=0;
-    foreach $label (@stdscienceLabels) {
-
-        chomp($label);
+    my $distributing;
+    foreach $stdsLabel (@stdscienceLabels) {
+
+    $distributing = 0;
+        foreach $distLabel (@distributionLabels) {
+            chomp($stdsLabel);
+            if ($stdsLabel eq $distLabel) { $distributing = 1; last;}
+
+
+        }
+        chomp($stdsLabel);
         printf("| %3d ", $i);
-        printf("| %32s ", $label);
-        printf("| %10s", getStateAndFaults($label, "chipRun", $state, "chip"));
-        printf("| %10s ", getStateAndFaults($label, "camRun", $state, "cam"));
-        printf("| %10s ", getStateAndFaults($label, "fakeRun", $state, "fake"));
-        printf("| %10s ", getStateAndFaults($label, "warpRun", $state, "warp"));
-        printf("| %10s ", getStateAndFaults($label, "stackRun", $state, "stack"));
-        printf("| %10s ", getStateAndFaults($label, "diffRun", $state, "diff"));
-        printf("| %10s ", getStateAndFaults($label, "magicRun", $state, "magic"));
-        printf("| %10s ", getStateAndFaults($label, "magicDSRun", $state, "magicDS"));
-        printf("| %10s ", getStateAndFaults($label, "distRun", $state, "dist"));
+        printf("| %32s ", $stdsLabel);
+        printf("| %10s    ", $distributing ? "yes" : "NO" );
+        printf("| %10s ", getStateAndFaults($stdsLabel, "chipRun", $state, "chip"));
+        printf("| %10s ", getStateAndFaults($stdsLabel, "camRun", $state, "cam"));
+        printf("| %10s ", getStateAndFaults($stdsLabel, "fakeRun", $state, "fake"));
+        printf("| %10s ", getStateAndFaults($stdsLabel, "warpRun", $state, "warp"));
+        printf("| %10s ", getStateAndFaults($stdsLabel, "stackRun", $state, "stack"));
+        printf("| %10s ", getStateAndFaults($stdsLabel, "diffRun", $state, "diff"));
+        printf("| %10s ", getStateAndFaults($stdsLabel, "magicRun", $state, "magic"));
+        printf("| %10s ", getStateAndFaults($stdsLabel, "magicDSRun", $state, "magicDS"));
+        printf("| %10s ", getStateAndFaults($stdsLabel, "distRun", $state, "dist"));
         printf("|\n");
         $i++;
     }
 
-    printf("+-----+----------------------------------+-----------+------------+------------+------------+------------+------------+------------+------------+------------+\n");
+    printf("+-----+----------------------------------+---------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+\n");
 
 }
