src/hg/hgTables/custom.c 1.38

1.38 2009/03/17 17:24:51 kent
Simplifying some logic where code was unnecessarily distinguishing between hPrintf and fprintf(stdout - which is an issue in the Genome Browser, but not here in the Table Browser. Also enabling select fields user interface.
Index: src/hg/hgTables/custom.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTables/custom.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -b -B -U 4 -r1.37 -r1.38
--- src/hg/hgTables/custom.c	3 Sep 2008 19:18:58 -0000	1.37
+++ src/hg/hgTables/custom.c	17 Mar 2009 17:24:51 -0000	1.38
@@ -191,8 +191,9 @@
 slReverse(&fieldList);
 return fieldList;
 }
 
+#ifdef UNUSED
 static void tabBedRow(struct bed *bed, struct slName *fieldList)
 /* Print out named fields from bed. */
 {
 struct slName *field;
@@ -258,8 +259,9 @@
         errAbort("Unrecognized bed field %s", type);
     }
 hPrintf("\n");
 }
+#endif /* UNUSED */
 
 static void tabBedRowFile(struct bed *bed, struct slName *fieldList, FILE *f)
 /* Print out to a file named fields from bed. */
 {
@@ -665,42 +667,26 @@
 else
     chosenFields = commaSepToSlNames(fields);
 
 if (f == NULL)
-    {
-    hPrintf("#");
-    for (field = chosenFields; field != NULL; field = field->next)
-        {
-        if (field != chosenFields)
-            hPrintf("\t");
-        hPrintf("%s", field->name);
-        }
-    hPrintf("\n");
-    }
-else
-    {
-    fprintf(f, "#");
-    for (field = chosenFields; field != NULL; field = field->next)
+    f = stdout;
+fprintf(f, "#");
+for (field = chosenFields; field != NULL; field = field->next)
         {
         if (field != chosenFields)
             fprintf(f, "\t");
         fprintf(f, "%s", field->name);
         }
-    fprintf(f, "\n");
-    }
+fprintf(f, "\n");
 
 for (region = regionList; region != NULL; region = region->next)
     {
     struct lm *lm = lmInit(64*1024);
     struct bed *bed, *bedList = cookedBedList(conn, track->tableName, 
     	region, lm, NULL);
     for (bed = bedList; bed != NULL; bed = bed->next)
 	{
-        if (f == NULL)
-	    tabBedRow(bed, chosenFields);
-        else
             tabBedRowFile(bed, chosenFields, f);
-	++count;
 	}
     lmCleanup(&lm);
     }
 if (count == 0)