Index: trunk/tools/bills/joinstkcmf
===================================================================
--- trunk/tools/bills/joinstkcmf	(revision 39000)
+++ trunk/tools/bills/joinstkcmf	(revision 39001)
@@ -29,5 +29,5 @@
     "test"              =>  \$test,
     "ofmt=s"            =>  \$ofmt,
-    "verbose|v"          =>  \$verbose,
+    "verbose|v"         =>  \$verbose,
     "save-temps"        =>  \$save_temps,
 ) or pod2usage( 2 );
@@ -38,6 +38,9 @@
 my $output = shift;
 
-# TODO: make this an option
-my $stiltsJar = '/home/panstarrs/bills/jars/stilts.jar';
+my $jardir = $ENV{JARDIR};
+if (!$jardir) {
+    $jardir = "/home/panstarrs/bills/jars";
+}
+my $stiltsJar = "$jardir/stilts.jar";
 
 my $stilts="java -jar $stiltsJar";
@@ -60,5 +63,5 @@
 my ($proj, $cell, $skycell_id);
 if (!$test) {
-    (undef, undef, undef, $proj, $cell, undef, $stack_id, undef, $skycal_id) = split '\.', $infilename;;
+    (undef, undef, undef, $proj, $cell, undef, $stack_id, undef, $skycal_id) = split '\.', $infilename;
 
     $skycell_id = sprintf "skycell.%04d.%03d", $proj, $cell;
@@ -67,8 +70,9 @@
     $stack_id += 0;
     $skycal_id = $stack_id;
-    my $results = `ftlist $path k include=SKYCELL | head -1`;
+    my $results = `echo $path | fields SKYCELL`;
     chomp $results;
-    print "$results\n";
-    (undef, undef, $skycell_id) = split " ", $results;
+    print "$results\n" if $verbose;
+    # (undef, undef, $skycell_id) = split " ", $results;
+    (undef, $skycell_id) = split " ", $results;
     (undef, $proj, $cell) = split '\.', $skycell_id;
     $cell += 0;
@@ -87,5 +91,4 @@
     . " fixcols=all suffix1='' suffix2=_exp suffix3=_dev suffix4=_ser suffix5='_xsrc'"
     . " out=$output"
-
     . " in1=$path#$exthead.psf  join1=always"
     . " icmd1='"
@@ -108,4 +111,6 @@
     ;
 
+$cmd .= " ofmt=$ofmt" if $ofmt;
+
 print "$cmd\n" if $verbose;
 
