mirror of
https://git.code.sf.net/p/ngspice/ngspice
synced 2026-08-22 05:47:42 +02:00
Search for .spiceinit (or spice.rc) firstly in a user defined directory,
when the directory path is set in the environmental variable SPICE_USERINIT_DIR. If not found then search in the current directory, then in HOME, then in USERPROFILE.
This commit is contained in:
+16
-2
@@ -1172,9 +1172,23 @@ int main(int argc, char **argv)
|
||||
else {
|
||||
if (readinit) {
|
||||
/* load user's initialisation file
|
||||
try accessing the initialisation file in the current directory
|
||||
if that fails try the alternate name */
|
||||
try accessing the initialisation file .spiceinit in a user provided
|
||||
path read from environmental variable SPICE_USERINIT_DIR,
|
||||
if that fails try the alternate name spice.rc, then look into
|
||||
the current directory, then the HOME directory, then into USERPROFILE */
|
||||
do {
|
||||
{
|
||||
const char* const userinit = getenv("SPICE_USERINIT_DIR");
|
||||
if (userinit) {
|
||||
if (read_initialisation_file(userinit, INITSTR) != FALSE) {
|
||||
break;
|
||||
}
|
||||
if (read_initialisation_file(userinit, ALT_INITSTR) != FALSE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (read_initialisation_file("", INITSTR) != FALSE) {
|
||||
break;
|
||||
}
|
||||
|
||||
+16
-3
@@ -927,10 +927,23 @@ ngSpice_Init(SendChar* printfcn, SendStat* statusfcn, ControlledExit* ngspiceexi
|
||||
}
|
||||
#else /* ~ HAVE_PWD_H */
|
||||
/* load user's initialisation file
|
||||
try accessing the initialisation file .spiceinit in the current directory
|
||||
if that fails try the alternate name spice.rc, then look into the HOME
|
||||
directory, then into USERPROFILE */
|
||||
try accessing the initialisation file .spiceinit in a user provided
|
||||
path read from environmental variable SPICE_USERINIT_DIR,
|
||||
if that fails try the alternate name spice.rc, then look into
|
||||
the current directory, then the HOME directory, then into USERPROFILE */
|
||||
do {
|
||||
{
|
||||
const char* const userinit = getenv("SPICE_USERINIT_DIR");
|
||||
if (userinit) {
|
||||
if (read_initialisation_file(userinit, INITSTR) != FALSE) {
|
||||
break;
|
||||
}
|
||||
if (read_initialisation_file(userinit, ALT_INITSTR) != FALSE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (read_initialisation_file("", INITSTR) != FALSE) {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user