SCP: Be sure to perform all library close activities whenever exiting
This commit is contained in:
parent
6a249c6246
commit
5cc86e2440
1 changed files with 14 additions and 12 deletions
26
scp.c
26
scp.c
|
@ -2797,15 +2797,15 @@ if ((stat = sim_ttinit ()) != SCPE_OK) {
|
||||||
sim_error_text (stat));
|
sim_error_text (stat));
|
||||||
if (sim_ttisatty())
|
if (sim_ttisatty())
|
||||||
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
||||||
free (targv);
|
sim_exit_status = EXIT_FAILURE;
|
||||||
return EXIT_FAILURE;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
if ((sim_eval = (t_value *) calloc (sim_emax, sizeof (t_value))) == NULL) {
|
if ((sim_eval = (t_value *) calloc (sim_emax, sizeof (t_value))) == NULL) {
|
||||||
fprintf (stderr, "Unable to allocate examine buffer\n");
|
fprintf (stderr, "Unable to allocate examine buffer\n");
|
||||||
if (sim_ttisatty())
|
if (sim_ttisatty())
|
||||||
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
||||||
free (targv);
|
sim_exit_status = EXIT_FAILURE;
|
||||||
return EXIT_FAILURE;
|
goto cleanup_and_exit;
|
||||||
};
|
};
|
||||||
if (sim_dflt_dev == NULL) /* if no default */
|
if (sim_dflt_dev == NULL) /* if no default */
|
||||||
sim_dflt_dev = sim_devices[0];
|
sim_dflt_dev = sim_devices[0];
|
||||||
|
@ -2814,8 +2814,8 @@ if ((stat = reset_all_p (0)) != SCPE_OK) {
|
||||||
sim_failed_reset_dptr->name, sim_error_text (stat));
|
sim_failed_reset_dptr->name, sim_error_text (stat));
|
||||||
if (sim_ttisatty())
|
if (sim_ttisatty())
|
||||||
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
||||||
free (targv);
|
sim_exit_status = EXIT_FAILURE;
|
||||||
return EXIT_FAILURE;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
if (register_check) {
|
if (register_check) {
|
||||||
/* This test is explicitly run after the above reset_all_p() so that any devices
|
/* This test is explicitly run after the above reset_all_p() so that any devices
|
||||||
|
@ -2825,13 +2825,13 @@ if (register_check) {
|
||||||
sim_printf ("Simulator device register sanity check error\n");
|
sim_printf ("Simulator device register sanity check error\n");
|
||||||
if (sim_ttisatty())
|
if (sim_ttisatty())
|
||||||
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
||||||
free (targv);
|
sim_exit_status = EXIT_FAILURE;
|
||||||
return EXIT_FAILURE;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
sim_printf ("*** Good Registers in %s simulator.\n", sim_name);
|
sim_printf ("*** Good Registers in %s simulator.\n", sim_name);
|
||||||
if (argc < 2) { /* No remaining command arguments? */
|
if (argc < 2) { /* No remaining command arguments? */
|
||||||
free (targv);
|
sim_exit_status = EXIT_SUCCESS; /* then we're done */
|
||||||
return EXIT_SUCCESS; /* then we're done */
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((stat = sim_brk_init ()) != SCPE_OK) {
|
if ((stat = sim_brk_init ()) != SCPE_OK) {
|
||||||
|
@ -2839,8 +2839,8 @@ if ((stat = sim_brk_init ()) != SCPE_OK) {
|
||||||
sim_error_text (stat));
|
sim_error_text (stat));
|
||||||
if (sim_ttisatty())
|
if (sim_ttisatty())
|
||||||
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
||||||
free (targv);
|
sim_exit_status = EXIT_FAILURE;
|
||||||
return EXIT_FAILURE;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
/* always check for register definition problems */
|
/* always check for register definition problems */
|
||||||
sim_sanity_check_register_declarations ();
|
sim_sanity_check_register_declarations ();
|
||||||
|
@ -2901,6 +2901,8 @@ if (SCPE_BARE_STATUS(stat) == SCPE_OPENERR) /* didn't exist/can't op
|
||||||
if (SCPE_BARE_STATUS(stat) != SCPE_EXIT)
|
if (SCPE_BARE_STATUS(stat) != SCPE_EXIT)
|
||||||
process_stdin_commands (SCPE_BARE_STATUS(stat), argv, FALSE);
|
process_stdin_commands (SCPE_BARE_STATUS(stat), argv, FALSE);
|
||||||
|
|
||||||
|
cleanup_and_exit:
|
||||||
|
|
||||||
detach_all (0, TRUE); /* close files */
|
detach_all (0, TRUE); /* close files */
|
||||||
sim_set_deboff (0, NULL); /* close debug */
|
sim_set_deboff (0, NULL); /* close debug */
|
||||||
sim_set_logoff (0, NULL); /* close log */
|
sim_set_logoff (0, NULL); /* close log */
|
||||||
|
|
Loading…
Add table
Reference in a new issue