From 29c51c0d30240022c085aa22ffa4216c1e26c3a2 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 4 Jun 2023 10:36:21 +0200 Subject: [PATCH] Bail out if {...} or '...' are missing around RHS of the equation. (...) may be possible, elsewhere additional {} are put around, so we have {(...)}. --- src/frontend/inpcom.c | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index aa9305c1d..8916c4d65 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -6240,14 +6240,9 @@ static void inp_compat(struct card *card) /* Find equation, starts with '{', till end of line */ str_ptr = strchr(cut_line, '{'); if (str_ptr == NULL) { - /* if not, equation may start with a '(' */ - str_ptr = strchr(cut_line, '('); - if (str_ptr == NULL) { - fprintf(stderr, "ERROR: mal formed R line: %s\n", - curr_line); - controlled_exit(EXIT_FAILURE); - } - equation = gettok_char(&str_ptr, ')', TRUE, TRUE); + fprintf(stderr, "ERROR: mal formed R line: %s\n", curr_line); + fprintf(stderr, " {...} or '...' around equation's right hand side are missing!\n"); + controlled_exit(EXIT_FAILURE); } else equation = gettok_char(&str_ptr, '}', TRUE, TRUE); @@ -6324,14 +6319,9 @@ static void inp_compat(struct card *card) /* Find equation, starts with '{', till end of line */ str_ptr = strchr(cut_line, '{'); if (str_ptr == NULL) { - /* if not, equation may start with a '(' */ - str_ptr = strchr(cut_line, '('); - if (str_ptr == NULL) { - fprintf(stderr, "ERROR: mal formed C line: %s\n", - curr_line); - controlled_exit(EXIT_FAILURE); - } - equation = gettok_char(&str_ptr, ')', TRUE, TRUE); + fprintf(stderr, "ERROR: mal formed C line: %s\n", curr_line); + fprintf(stderr, " {...} or '...' around equation's right hand side are missing!\n"); + controlled_exit(EXIT_FAILURE); } else equation = gettok_char(&str_ptr, '}', TRUE, TRUE); @@ -6399,14 +6389,9 @@ static void inp_compat(struct card *card) /* Find equation, starts with '{', till end of line */ str_ptr = strchr(cut_line, '{'); if (str_ptr == NULL) { - /* if not, equation may start with a '(' */ - str_ptr = strchr(cut_line, '('); - if (str_ptr == NULL) { - fprintf(stderr, "ERROR: mal formed L line: %s\n", - curr_line); - controlled_exit(EXIT_FAILURE); - } - equation = gettok_char(&str_ptr, ')', TRUE, TRUE); + fprintf(stderr, "ERROR: mal formed L line: %s\n", curr_line); + fprintf(stderr, " {...} or '...' around equation's right hand side are missing!\n"); + controlled_exit(EXIT_FAILURE); } else equation = gettok_char(&str_ptr, '}', TRUE, TRUE);