Skip to content

Commit bd6c971

Browse files
committed
better status, setting of error_line and error_lineo
1 parent e2241ec commit bd6c971

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

c/xdifile.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ XDI_readfile(char *filename, XDIFile *xdifile) {
277277
return ERR_META_FORMAT;
278278
}
279279
} else {
280-
if (ignored_headerline < 0) {
280+
if ((ignored_headerline < 0) && (has_minusline == 0)) {
281281
ignored_headerline = i;
282282
}
283283
}
@@ -353,6 +353,9 @@ XDI_readfile(char *filename, XDIFile *xdifile) {
353353
for (i = nheader-2; i < ilen; i++) {
354354
/* may find a header line interspersed in array data */
355355
COPY_STRING(line, textlines[i]);
356+
xdifile->error_lineno = i;
357+
COPY_STRING(xdifile->error_line, line);
358+
356359
if (strncmp(textlines[i], TOK_COMM, 1) == 0) {
357360
line++;
358361
nwords = split_on(line, TOK_DELIM, words);
@@ -378,6 +381,10 @@ XDI_readfile(char *filename, XDIFile *xdifile) {
378381
++ipt;
379382
}
380383
}
384+
/* success */
385+
xdifile->error_lineno = 0;
386+
COPY_STRING(xdifile->error_line, "");
387+
381388
xdifile->npts = ipt;
382389
xdifile->nouter = iouter;
383390
xdifile->narrays = ncols;
@@ -389,6 +396,7 @@ XDI_readfile(char *filename, XDIFile *xdifile) {
389396
xdifile->outer_array[j] = outer_arr[j];
390397
xdifile->outer_breakpts[j] = outer_pts[j];
391398
}
399+
392400
return iret;
393401

394402
}

0 commit comments

Comments
 (0)