SCP: On startup, only exit if initialization file explicitly returns SCPE_EXIT

Fix for problem reported in #625
This commit is contained in:
Mark Pizzolato 2018-09-28 09:36:14 -07:00
parent f48c282dff
commit 9a716a7689

6
scp.c
View file

@ -2528,7 +2528,7 @@ if (cptr && sizeof (nbuf) > strlen (cptr) + strlen ("/simh.ini") + 1) {
sprintf(nbuf, "\"%s%s%ssimh.ini\"", cptr2 ? cptr2 : "", cptr, strchr (cptr, '/') ? "/" : "\\"); sprintf(nbuf, "\"%s%s%ssimh.ini\"", cptr2 ? cptr2 : "", cptr, strchr (cptr, '/') ? "/" : "\\");
stat = do_cmd (-1, nbuf) & ~SCPE_NOMESSAGE; /* simh.ini proc cmd file */ stat = do_cmd (-1, nbuf) & ~SCPE_NOMESSAGE; /* simh.ini proc cmd file */
} }
if (stat == SCPE_OPENERR) if (SCPE_BARE_STATUS(stat) == SCPE_OPENERR)
stat = do_cmd (-1, "simh.ini"); /* simh.ini proc cmd file */ stat = do_cmd (-1, "simh.ini"); /* simh.ini proc cmd file */
if (*cbuf) /* cmd file arg? */ if (*cbuf) /* cmd file arg? */
stat = do_cmd (0, cbuf); /* proc cmd file */ stat = do_cmd (0, cbuf); /* proc cmd file */
@ -2552,13 +2552,13 @@ else if (*argv[0]) { /* sim name arg? */
} }
} }
} }
if (stat == SCPE_OPENERR) /* didn't exist/can't open? */ if (SCPE_BARE_STATUS(stat) == SCPE_OPENERR) /* didn't exist/can't open? */
stat = SCPE_OK; stat = SCPE_OK;
if (sim_switches & SWMASK ('T')) /* Command Line -T switch */ if (sim_switches & SWMASK ('T')) /* Command Line -T switch */
stat = sim_library_unit_tests (); /* run library unit tests */ stat = sim_library_unit_tests (); /* run library unit tests */
if (stat == SCPE_OK) if (SCPE_BARE_STATUS(stat) != SCPE_EXIT)
process_stdin_commands (SCPE_BARE_STATUS(stat), argv); process_stdin_commands (SCPE_BARE_STATUS(stat), argv);
detach_all (0, TRUE); /* close files */ detach_all (0, TRUE); /* close files */