Index: trunk/tools/examine_burntool_pcontrol.pl
===================================================================
--- trunk/tools/examine_burntool_pcontrol.pl	(revision 25425)
+++ trunk/tools/examine_burntool_pcontrol.pl	(revision 25472)
@@ -5,8 +5,10 @@
 use Getopt::Std;
 
-getopts('hf',\%opt);
+getopts('hfcP',\%opt);
 if (exists($opt{h})) {
     print STDERR "Usage: examine_burntool_pcontrol.pl [-f] <pcontrol.pro>\n";
     print STDERR "         -f          Read all burntool entries, even those commented out.\n";
+    print STDERR "         -c          Print out the needed mysql statement to do a convert. DOES NOT EXECUTE THIS!\n";
+    print STDERR "         -P          Print out the ipp_apply_burntool.pl commands, even if fully updated.\n";
     print STDERR "\n";
     print STDERR "         Reads in the pcontrol.pro file you're using to run burntool, and uses the\n";
@@ -19,4 +21,5 @@
     print STDERR "                  B             Current version value for burntool_state. Burntool succeeded.\n";
     print STDERR "                  b             Old version value for burntool_state. Burntool needs to be rerun.\n";
+    print STDERR "                  ?             No matching rawImfile entry found in database.\n";
     exit(1);
 }
@@ -36,4 +39,5 @@
     print STDERR "GOOD == $burntoolStateGood\n";
 }
+$convert_bt_state = -1.0 * $burntoolStateGood;
 
 # Read a class_id and burntool_state pair, and set the correct cell of the (sorry, global) character array vector
@@ -121,4 +125,6 @@
     # images on a single night.
     $sth = "SELECT exp_id,exp_name,obs_mode,dateobs,class_id,burntool_state,comment FROM rawImfile WHERE dateobs >= '${dmin}' AND dateobs <= '${dmax}' order by dateobs limit 60000";
+
+    $no_sth = "UPDATE rawImfile SET burntool_state = $convert_bt_state WHERE dateobs >= '${dmin}' AND dateobs <= '${dmax}' AND user_1 = 1.0;";
     $data_ref = $db->selectall_arrayref( $sth );
 
@@ -133,4 +139,7 @@
     # Print out query for clarity, and the header:
     print "#### $sth\n";
+    if (exists($opt{c})) {
+	print "#### $no_sth\n";
+    }
     print "#                                                     0       1       2       3       4       5       6       7       \n";
     print "#exp_i exp_name       obs_mode dateobs             nB 0123456701234567012345670123456701234567012345670123456701234567 comment\n";
@@ -176,5 +185,5 @@
 		    }
 		    else {
-			$vector[$j] = '[32m?[m';
+			$vector[$j] = '[36;40;01m?[m';
 		    }
 		}
@@ -192,8 +201,8 @@
 
     # If we didn't find that all 60 chips had succesful burntools run, print out the ipp_apply_burntool.pl command we would need to fix this:
-    if ($burncount != 60) {
+    if (($burncount != 60)||(exists($opt{P}))) {
 	for ($j = 0; $j < 64; $j++) {
 #	    printf("%d %s %d\n",$j, $vector[$j], ($vector[$j] !~ /B/));
-	    if ($vector[$j] !~ /B/) {
+	    if (($vector[$j] !~ /B/)||(exists($opt{P}))) {
 		if ($vector[$j] ne '_') {
 		    $id = sprintf("XY%d%d",int($j / 8),$j % 8);
