mirror of
https://github.com/simh/simh.git
synced 2026-04-17 00:36:00 +00:00
SCP: Rework SEND and EXPECT commands to provide default and temporary arguments
- EXPECT HALTAFTER=nnn
--> sets "nnn" as the global/default value
- EXPECT "some string"
--> uses the "nnn" global/default value
- EXPECT HALTAFTER=ttt "some string"
--> uses the "ttt" temporary value for this EXPECT only
and:
- SEND AFTER=nnn
--> sets "nnn" as the global/default value
- SEND "some string"
--> uses the "nnn" global/default value
- SEND AFTER=ttt "some string"
--> uses the "ttt" temporary value for this SEND only
(and similarly for the SEND DELAY value).
This commit is contained in:
@@ -234,7 +234,7 @@ TMLN sim_con_ldsc = { 0 }; /* console l
|
||||
TMXR sim_con_tmxr = { 1, 0, 0, &sim_con_ldsc, NULL, &sim_con_telnet };/* console line mux */
|
||||
|
||||
|
||||
SEND sim_con_send = {SEND_DEFAULT_DELAY, &sim_con_telnet, DBG_SND};
|
||||
SEND sim_con_send = {0, &sim_con_telnet, DBG_SND};
|
||||
EXPECT sim_con_expect = {&sim_con_telnet, DBG_EXP};
|
||||
|
||||
static t_bool sim_con_console_port = TRUE;
|
||||
@@ -3969,7 +3969,8 @@ else {
|
||||
(sim_switches & SWMASK ('I')) ? "" : "\n");
|
||||
free (mbuf);
|
||||
mbuf = sim_encode_quoted_string ((uint8 *)mbuf2, strlen (mbuf2));
|
||||
sim_exp_set (&sim_con_expect, mbuf, 0, sim_con_expect.after, EXP_TYP_PERSIST, NULL);
|
||||
sim_switches = EXP_TYP_PERSIST;
|
||||
sim_set_expect (&sim_con_expect, mbuf);
|
||||
free (mbuf);
|
||||
free (mbuf2);
|
||||
}
|
||||
@@ -3992,7 +3993,7 @@ else {
|
||||
|
||||
rbuf = (uint8 *)malloc (1 + strlen(cptr));
|
||||
|
||||
decode ((char *)rbuf, cptr); /* decod string */
|
||||
decode ((char *)rbuf, cptr); /* decode string */
|
||||
sim_send_input (&sim_con_send, rbuf, strlen((char *)rbuf), 0, 0); /* queue it for output */
|
||||
free (rbuf);
|
||||
}
|
||||
@@ -4011,9 +4012,12 @@ if (cptr == NULL || *cptr == 0) /* no argument string? *
|
||||
return SCPE_2FARG; /* need an argument */
|
||||
|
||||
val = (int32) get_uint (cptr, 10, INT_MAX, &r); /* parse the argument */
|
||||
if (r == SCPE_OK) { /* parse OK? */
|
||||
char gbuf[CBUFSIZE];
|
||||
|
||||
if (r == SCPE_OK) /* parse OK? */
|
||||
sim_con_expect.after = val; /* save the delay value */
|
||||
snprintf (gbuf, sizeof (gbuf), "HALTAFTER=%d", val);
|
||||
expect_cmd (1, gbuf);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user