From 53e25b735adb35e0b79fd2a1645c81ec15928cfc Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 10 Jun 2022 15:35:21 +0200 Subject: [PATCH] This is a fix to bug report 589 by Bohdan Tkhir: Remove only mfg=something, icrating=, vceo=, type=, not any combination of text like net_type=... . Restrict this removal to compatibility modes ps or lt. --- src/frontend/inpcom.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index c0e80c225..595154864 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -1050,7 +1050,8 @@ struct card *inp_readall(FILE *fp, const char *dir_name, inp_rem_unused_models(root, working); } - rem_mfg_from_models(working); + if (newcompat.lt || newcompat.ps) + rem_mfg_from_models(working); subckt_params_to_param(working); @@ -9689,8 +9690,8 @@ static void rem_mfg_from_models(struct card *deck) continue; /* remove mfg=name */ if (ciprefix(".model", curr_line)) { - start = strstr(curr_line, "mfg="); - if (start) { + start = search_plain_identifier(curr_line, "mfg"); + if (start && start[3] == '=') { end = nexttok(start); if (*end == '\0') *start = '\0'; @@ -9700,8 +9701,8 @@ static void rem_mfg_from_models(struct card *deck) start++; } } - start = strstr(curr_line, "icrating="); - if (start) { + start = search_plain_identifier(curr_line, "icrating"); + if (start && start[8] == '=') { end = nexttok(start); if (*end == '\0') *start = '\0'; @@ -9711,8 +9712,8 @@ static void rem_mfg_from_models(struct card *deck) start++; } } - start = strstr(curr_line, "vceo="); - if (start) { + start = search_plain_identifier(curr_line, "vceo"); + if (start && start[4] == '=') { end = nexttok(start); if (*end == '\0') *start = '\0'; @@ -9722,8 +9723,8 @@ static void rem_mfg_from_models(struct card *deck) start++; } } - start = strstr(curr_line, "type="); - if (start) { + start = search_plain_identifier(curr_line, "type"); + if (start && start[4] == '=') { end = nexttok(start); if (*end == '\0') *start = '\0';