7aaf56b7663af02ff5dc2969238150466806e7f1 kent Thu Apr 20 10:28:30 2017 -0700 First cut at utility to rename submit file names in database. diff --git src/lib/fieldedTable.c src/lib/fieldedTable.c index 8a9c120..802cffd 100644 --- src/lib/fieldedTable.c +++ src/lib/fieldedTable.c @@ -182,48 +182,54 @@ if (differentString(reportFileName, fileName)) { freeMem(lf->fileName); lf->fileName = cloneString(reportFileName); } } else { reportFileName = fileName; } /* Get first line and turn it into field list. */ char *line; if (!lineFileNext(lf, &line, NULL)) errAbort("%s is empty", reportFileName); +boolean startsSharp = FALSE; if (line[0] == '#') + { line = skipLeadingSpaces(line+1); + startsSharp = TRUE; + } + int fieldCount = chopByChar(line, '\t', NULL, 0); char *fields[fieldCount]; chopTabs(line, fields); /* Make sure that all required fields are present. */ int i; for (i = 0; i < requiredCount; ++i) { char *required = requiredFields[i]; int ix = stringArrayIx(required, fields, fieldCount); if (ix < 0) errAbort("%s is missing required field '%s'", reportFileName, required); } /* Create fieldedTable . */ struct fieldedTable *table = fieldedTableNew(reportFileName, fields, fieldCount); +table->startsSharp = startsSharp; while (lineFileRowTab(lf, fields)) { fieldedTableAdd(table, fields, fieldCount, lf->lineIx); } /* Clean up and go home. */ lineFileClose(&lf); return table; } int fieldedTableMustFindFieldIx(struct fieldedTable *table, char *field) /* Find index of field in table's row. Abort if field not found. */ { int ix = stringArrayIx(field, table->fields, table->fieldCount); if (ix < 0)