1f36dac15fb404318112d4c3271d4b14eba70223
kent
  Mon May 24 17:35:05 2021 -0700
Making library tolerate extra lines that start with % in matrix market.

diff --git src/lib/matrixMarket.c src/lib/matrixMarket.c
index cced410..9f6ba3a 100644
--- src/lib/matrixMarket.c
+++ src/lib/matrixMarket.c
@@ -20,30 +20,41 @@
 struct matrixMarket *matrixMarketOpen(char *fileName)
 /* Open a matrixMarket file and read header, return a handle for use in more routines. */
 {
 struct lineFile *lf = lineFileOpen(fileName, TRUE);
 char *row[6];	// Big enough for header
 int rowSize;
 
 /* Get header line, check for errors */
 rowSize = lineFileChopNext(lf, row, ArraySize(row));
 lineFileExpectWords(lf, 5, rowSize);
 if (differentString(row[0], "%%MatrixMarket"))
    errAbort("%s is not a MatrixMarket file", fileName);
 if (differentWord(row[1], "matrix"))
     errAbort("%s is not a MatrixMarket matrix", fileName);
 
+/* Skip over other lines that start with % */
+char *line;
+while (lineFileNext(lf, &line, NULL))
+    {
+    if (line[0] != '%')
+        {
+	lineFileReuse(lf);
+	break;
+	}
+    }
+
 /* Allocate our return object and fill in what we can from the header line */
 struct matrixMarket *mm;
 AllocVar(mm);
 mm->lf = lf;
 mm->format = cloneString(row[2]);
 mm->type = cloneString(row[3]);
 mm->symmetries = cloneString(row[4]);
 
 /* Precalculate a shortcut or two */
 mm->isInt = sameWord(mm->type, "integer");
 
 /* Get the dimensions line and save it in our data structure */
 rowSize = lineFileChopNext(lf, row, ArraySize(row));
 lineFileExpectWords(lf, 3, rowSize);
 mm->colCount = lineFileNeedNum(lf, row, 0);