From 243e9652e52712129125dad104515ec1cb44768a Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 22 May 2019 16:12:13 -0400 Subject: [PATCH] Added information to the GDS read routine error output to indicate the byte position of the error. --- calma/CalmaRead.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/calma/CalmaRead.c b/calma/CalmaRead.c index 25c5e3aa..1ddd00a8 100644 --- a/calma/CalmaRead.c +++ b/calma/CalmaRead.c @@ -353,25 +353,31 @@ calmaReadError(format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) char *format; char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10; { + off_t filepos; + calmaTotalErrors++; if (CIFWarningLevel == CIF_WARN_NONE) return; if ((calmaTotalErrors < 100) || (CIFWarningLevel != CIF_WARN_LIMIT)) { + filepos = ftello(calmaInputFile); if (CIFWarningLevel == CIF_WARN_REDIRECT) { if (calmaErrorFile != NULL) { - fprintf(calmaErrorFile, "Error while reading cell \"%s\": ", + fprintf(calmaErrorFile, "Error while reading cell \"%s\" ", cifReadCellDef->cd_name); + fprintf(calmaErrorFile, "(byte position %"DLONG_PREFIX"ld): ", + (dlong)filepos); fprintf(calmaErrorFile, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } } else { - TxError("Error while reading cell \"%s\": ", cifReadCellDef->cd_name); + TxError("Error while reading cell \"%s\" ", cifReadCellDef->cd_name); + TxError("(byte position %"DLONG_PREFIX"d): ", (dlong)filepos); TxError(format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } }