From 7c90004921a26fade9b4d9d2e4e81da34d9ac522 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sat, 4 Aug 2018 18:36:06 +0200 Subject: [PATCH] add Inp_Path to sourcepath variable Patch provided by Uros Platise https://sourceforge.net/p/ngspice/ngspice/merge-requests/4/ --- src/frontend/inpcom.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 8e4c79351..659d11f93 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -995,6 +995,16 @@ inp_read(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile) } } } else { + /* add Inp_Path to sourcepath variable */ + char *p; + if ((p = strstr(buffer, "sourcepath"))) { + if ((p = strchr(buffer, ')'))) { + *p = 0; // clear ) and insert Inp_Path in between + p = tprintf("%s %s ) %s", buffer, Inp_Path ? Inp_Path : "", p + 1); + tfree(buffer); + buffer = p; + } + } /* exclude commands listed above to preserve filename case */ for (s = buffer; *s && (*s != '\n'); s++) ;