SCP: Fix ON ERROR default declaration

- Additionally, be sure that ON actions are saved with unexpanded variables

As reported #681
This commit is contained in:
Mark Pizzolato 2019-04-17 20:12:21 -07:00
parent 0c39921fb7
commit 8d172a4049

4
scp.c
View file

@ -4941,12 +4941,12 @@ else {
return sim_messagef (SCPE_ARG, "Invalid argument: %s\n", gbuf);
}
}
if (cond == SCPE_OK)
return sim_messagef (SCPE_ARG, "Invalid argument: %s\n", gbuf);
if ((NULL == cptr) || ('\0' == *cptr)) { /* Empty Action */
free(sim_on_actions[sim_do_depth][cond]); /* Clear existing condition */
sim_on_actions[sim_do_depth][cond] = NULL; }
else {
if ((cptr > sim_sub_instr_buf) && ((size_t)(cptr - sim_sub_instr_buf) < sim_sub_instr_size))
cptr = &sim_sub_instr[sim_sub_instr_off[cptr - sim_sub_instr_buf]]; /* get un-substituted string */
sim_on_actions[sim_do_depth][cond] =
(char *)realloc(sim_on_actions[sim_do_depth][cond], 1+strlen(cptr));
strcpy(sim_on_actions[sim_do_depth][cond], cptr);