add Inp_Path to sourcepath variable

Patch provided by Uros Platise
https://sourceforge.net/p/ngspice/ngspice/merge-requests/4/
This commit is contained in:
Holger Vogt 2018-08-04 18:36:06 +02:00
parent ab9ffc2319
commit 7c90004921
1 changed files with 10 additions and 0 deletions

View File

@ -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++)
;