From a463d0563fa4b44183bf4226a5c318f4db77b4b3 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 8 Mar 2020 11:12:24 +0100 Subject: [PATCH] Revert "re-write inp_rep_ixx(), catch all known cases," This reverts commit 55c4f161349ac40267ae8546b2711c043a4351f3. --- src/frontend/inpcom.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index dc99badc1..4b2a992d9 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -1762,26 +1762,22 @@ static void inp_rep_ixx(struct card* deck) { } char* new_str = NULL; - bool strsave = FALSE; while (line) { - char* s = strstr(line, "i(v"); - if (s && (s > line) && (isspace_c(s[-1]) || is_arith_char(s[-1]) - || isquote(s[-1]) || (s[-1] == '=') || (s[-1] == '.'))) { + char* s = strstr(line, " i(v"); + if (s) { char* beg_str, *end_str, *t; - line = s; /* replace i(vxx) by vxx#branch */ if (get_r_paren(&line) == 1) { fprintf(stderr, "Error: missing ')' in line\n %s\n", c->line); break; } /* token containing name of voltage source to be measured */ - t = copy_substring(s + 2, line - 1); + t = copy_substring(s + 3, line - 1); /* change line, convert i(XXX) to XXX#branch */ beg_str = copy_substring(beg, s); end_str = copy(line); tfree(new_str); - new_str = tprintf("%s%s%s%s", beg_str, t, "#branch", end_str); - strsave = TRUE; + new_str = tprintf("%s %s%s %s", beg_str, t, "#branch", end_str); beg = line = new_str; tfree(beg_str); tfree(end_str); @@ -1791,10 +1787,9 @@ static void inp_rep_ixx(struct card* deck) { break; } } - if (strsave) { + if (new_str) { tfree(c->line); c->line = new_str; - strsave = FALSE; } } }