From 5e27a8f6de5e7796ad40a26582948f571530d69e Mon Sep 17 00:00:00 2001 From: Giles Atkinson <“gatk555@gmail.com”> Date: Tue, 30 Jun 2026 10:23:59 +0100 Subject: [PATCH] Fix file name quoting for .LIB. Reported by Tom Hajar in ngspice-users. --- src/frontend/inpcom.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index c0bdac998..8a0c71f21 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -3934,12 +3934,16 @@ static struct card *expand_section_ref(struct card *c, const char *dir_name) char *s, *s_e, *y; s = skip_non_ws(line); - while (isspace_c(*s) || isquote(*s)) + while (isspace_c(*s)) s++; - for (s_e = s; *s_e && !isspace_c(*s_e) && !isquote(*s_e); s_e++) - ; + if (isquote(*s)) + for (s_e = ++s; *s_e && !isquote(*s_e); s_e++) ; + else + for (s_e = s; *s_e && !isspace_c(*s_e) && !isquote(*s_e); s_e++) ; y = s_e; - while (isspace_c(*y) || isquote(*y)) + if (y && isquote(*y)) + ++y; + while (isspace_c(*y)) y++; if (*y) { @@ -3950,8 +3954,10 @@ static struct card *expand_section_ref(struct card *c, const char *dir_name) char *y_e; struct library *lib; - for (y_e = y; *y_e && !isspace_c(*y_e) && !isquote(*y_e); y_e++) - ; + if (isquote(*y)) + for (y_e = ++y; *y_e && !isquote(*y_e); y_e++) ; + else + for (y_e = y; *y_e && !isspace_c(*y_e) && !isquote(*y_e); y_e++) ; keep_char1 = *s_e; keep_char2 = *y_e; *s_e = '\0';