760d941586a240c1b4c4e1143f1fd2a3f8ff96c1 braney Fri Apr 7 11:26:45 2017 -0700 add the ability to specify a fielded tab-sep file for metadata in a track hub diff --git src/lib/fieldedTable.c src/lib/fieldedTable.c index 8ee4546..8a9c120 100644 --- src/lib/fieldedTable.c +++ src/lib/fieldedTable.c @@ -1,27 +1,28 @@ /* fieldedTable - a table composed of untyped strings in memory. Includes names for each * field. This is a handy way of storing small-to-medium tab-separated files that begin * with a "#list of fields" line among other things. */ /* Copyright (C) 2013 The Regents of the University of California * See README in this or parent directory for licensing information. */ #include "common.h" #include "localmem.h" #include "linefile.h" #include "hash.h" #include "fieldedTable.h" +#include "net.h" struct fieldedTable *fieldedTableNew(char *name, char **fields, int fieldCount) /* Create a new empty fieldedTable with given name, often a file name. */ { struct fieldedTable *table; AllocVar(table); struct lm *lm = table->lm = lmInit(0); table->name = lmCloneString(lm, name); table->cursor = &table->rowList; table->fieldCount = fieldCount; int i; char **row = lmAllocArray(lm, table->fields, fieldCount); for (i=0; irowList = newList; lmCleanup(&lm); } struct fieldedTable *fieldedTableFromTabFile(char *fileName, char *reportFileName, char *requiredFields[], int requiredCount) /* Read table from tab-separated file with a #header line that defines the fields. Ensures * all requiredFields (if any) are present. The reportFileName is just used for error reporting and * should be NULL for most purposes. This is used by edwSubmit though which * first copies to a local file, and we want to report errors from the remote file. * We do know the remote file exists at least, because we just copied it. */ { /* Open file with fileName */ -struct lineFile *lf = lineFileOpen(fileName, TRUE); +struct lineFile *lf = netLineFileOpen(fileName); /* Substitute in reportFileName for error reporting */ if (reportFileName != NULL) { if (differentString(reportFileName, fileName)) { freeMem(lf->fileName); lf->fileName = cloneString(reportFileName); } } else { reportFileName = fileName; }