From 13c5fd15b9e3c823d0877f84674b38699656d478 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 5 Jan 2020 00:05:20 +0100 Subject: [PATCH] Improve error messages for the 'meas' command. --- src/frontend/com_measure2.c | 6 +++--- src/frontend/measure.c | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/frontend/com_measure2.c b/src/frontend/com_measure2.c index 5346cf7c9..936f5420a 100644 --- a/src/frontend/com_measure2.c +++ b/src/frontend/com_measure2.c @@ -1169,7 +1169,7 @@ measure_parse_stdParams( wl = wl->wl_next; continue; } else { - sprintf(errbuf, "bad syntax of ??\n"); + sprintf(errbuf, "bad syntax. equal sign missing ?\n"); return 0; } } @@ -1179,7 +1179,7 @@ measure_parse_stdParams( } else { if (ft_numparse(&pValue, FALSE, &engVal1) < 0) { - sprintf(errbuf, "bad syntax of ??\n"); + sprintf(errbuf, "bad syntax, cannot evaluate right hand side of %s=%s\n", pName, pValue); return 0; } } @@ -1216,7 +1216,7 @@ measure_parse_stdParams( } if (pCnt == 0) { - sprintf(errbuf, "bad syntax of ??\n"); + sprintf(errbuf, "bad syntax of %s\n", pName); return 0; } diff --git a/src/frontend/measure.c b/src/frontend/measure.c index 603b2d0af..068f8b7b6 100644 --- a/src/frontend/measure.c +++ b/src/frontend/measure.c @@ -67,6 +67,12 @@ com_meas(wordlist *wl) May be in the next wl_word */ if (token[strlen(token) - 1] == '=') { wl_index = wl_index->wl_next; + if (wl_index == NULL) { + line_in = wl_flatten(wl); + fprintf(stderr, "\nError: meas %s failed!\n\n", line_in); + tfree(line_in); + return; + } vec_found = wl_index->wl_word; /* token may be already a value, maybe 'LAST', which we have to keep, or maybe a vector */ if (!cieq(vec_found, "LAST")) {