From 8d172a40492f97a8daf0f313a4f363a21bff66c0 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Wed, 17 Apr 2019 20:12:21 -0700 Subject: [PATCH] SCP: Fix ON ERROR default declaration - Additionally, be sure that ON actions are saved with unexpanded variables As reported #681 --- scp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scp.c b/scp.c index e06ab8d0..3fa9b8a9 100644 --- a/scp.c +++ b/scp.c @@ -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);