From df63d4ff9f0115d99d2f3938373ceb741b30c9e0 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Tue, 5 May 2020 12:57:43 -0700 Subject: [PATCH] SCP: Reject undefined device with TESTLIB command Also remove some otherwise unused variables (assignments but never used). --- scp.c | 10 ++++------ sim_console.c | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/scp.c b/scp.c index e4e41859..463a1d26 100644 --- a/scp.c +++ b/scp.c @@ -4359,7 +4359,6 @@ char *ip = instr, *op, *oend, *istart, *tmpbuf; const char *ap; char rbuf[CBUFSIZE]; int i; -size_t instr_off = 0; size_t outstr_off = 0; sim_exp_argv = do_arg; @@ -6721,7 +6720,6 @@ static void sim_type_entry (const char *directory, const struct stat *filestat, void *context) { -TYPE_CTX *ctx = (TYPE_CTX *)context; char FullPath[PATH_MAX + 1]; FILE *file; char lbuf[4*CBUFSIZE]; @@ -7169,8 +7167,6 @@ t_stat show_runlimit (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char { if (sim_runlimit_enabled) { if (sim_runlimit_switches & SWMASK ('T')) { - double inst_per_sec = sim_timer_inst_per_sec (); - if (sim_runlimit_d_initial != sim_runlimit_d) { fprintf (st, "%s initially, ", sim_fmt_secs (sim_runlimit_d_initial / 1000000.0)); if (sim_is_active (&sim_runlimit_unit)) @@ -14946,7 +14942,6 @@ return cptr; */ static const char *sim_into_postfix (Stack *stack1, const char *cptr, t_stat *stat, t_bool parens_required) { -const char *start = cptr; const char *last_cptr; int parens = 0; Operator *op = NULL, *last_op; @@ -15403,7 +15398,6 @@ return stat; t_stat test_lib_cmd (int32 flag, CONST char *cptr) { int i; -int bad_regs = 0; DEVICE *dptr; int32 saved_switches = sim_switches & ~SWMASK ('T'); t_stat stat = SCPE_OK; @@ -15412,6 +15406,10 @@ char gbuf[CBUFSIZE]; cptr = get_glyph (cptr, gbuf, 0); if (gbuf[0] == '\0') strcpy (gbuf, "ALL"); +else { + if (!find_dev (gbuf)) + return sim_messagef (SCPE_ARG, "No such device: %s\n", gbuf); + } if (sim_switches & SWMASK ('D')) { sim_switches &= ~(SWMASK ('D') | SWMASK ('R') | SWMASK ('F') | SWMASK ('T')); sim_set_debon (0, "STDOUT"); diff --git a/sim_console.c b/sim_console.c index 888b9f4b..bb5e04b4 100644 --- a/sim_console.c +++ b/sim_console.c @@ -876,7 +876,6 @@ static void _sim_rem_log_out (TMLN *lp) { char cbuf[4*CBUFSIZE]; REMOTE *rem = &sim_rem_consoles[(int)(lp - sim_rem_con_tmxr.ldsc)]; -int line = rem->line; if ((!sim_oline) && (sim_log)) { fflush (sim_log);