SCP: Fixes Cannot show radix, etc. for a device that has no modifiers and SET and SHOW responses for invalid entry are inconsistent. from Dave Bryan

001. PROBLEM:  Cannot show radix, etc. for a device that has no modifiers.

     OBSERVATION:  The default data radix for a device may be set with the SET
     <dev> OCT|DEC|HEX command.  However, if the device does not have a modifier
     table, SHOW <dev> RADIX is rejected with "No settable parameters".

     The same problem occurs for SHOW <dev> DEBUG and SHOW <dev> NAMES.  For a
     device that provides debug printouts, SHOW <dev> MOD will list "DEBUG,
     NODEBUG" among the modifiers, and the SHOW <dev> DEBUG command will display
     the current debug status.  However, if the device does not contain a
     modifier table, SHOW <dev> MOD and SHOW <dev> DEBUG will report "No
     settable parameters", even though SET <dev> DEBUG is accepted and works as
     expected.  For such a device, SHOW MOD will show "DEBUG, NODEBUG" as
     acceptable modifiers.

002. PROBLEM:  SET and SHOW responses for invalid entry are inconsistent.

     OBSERVATION:  Entering SET <dev> <mod> where <mod> is not defined in the
     device's modifier table displays "Non-existent parameter."  Entering SHOW
     with the same parameters displays "Invalid argument."

     Similarly, entering SET <dev> DEBUG for a device that does not have
     debugging capability displays "Command not allowed."  Entering SHOW with
     the same parameters displays nothing.

     In both cases, the messages displayed should be the same for the same
     error.
This commit is contained in:
Mark Pizzolato 2014-12-17 21:00:38 -08:00
parent e87d40c600
commit 42e7d48c82

20
scp.c
View file

@ -3999,15 +3999,13 @@ if (*cptr == 0) { /* now eol? */
show_device (ofile, dptr, 0): show_device (ofile, dptr, 0):
show_unit (ofile, dptr, uptr, -1); show_unit (ofile, dptr, uptr, -1);
} }
if (dptr->modifiers == NULL) /* any modifiers? */
return SCPE_NOPARAM;
GET_SWITCHES (cptr); /* get more switches */ GET_SWITCHES (cptr); /* get more switches */
while (*cptr != 0) { /* do all mods */ while (*cptr != 0) { /* do all mods */
cptr = get_glyph (cptr, gbuf, ','); /* get modifier */ cptr = get_glyph (cptr, gbuf, ','); /* get modifier */
if ((cvptr = strchr (gbuf, '='))) /* = value? */ if ((cvptr = strchr (gbuf, '='))) /* = value? */
*cvptr++ = 0; *cvptr++ = 0;
for (mptr = dptr->modifiers; mptr->mask != 0; mptr++) { for (mptr = dptr->modifiers; mptr && (mptr->mask != 0); mptr++) {
if (((mptr->mask & MTAB_XTD)? /* right level? */ if (((mptr->mask & MTAB_XTD)? /* right level? */
((mptr->mask & lvl) == lvl): (MTAB_VUN & lvl)) && ((mptr->mask & lvl) == lvl): (MTAB_VUN & lvl)) &&
((mptr->disp && mptr->pstring && /* named disp? */ ((mptr->disp && mptr->pstring && /* named disp? */
@ -4023,10 +4021,18 @@ while (*cptr != 0) { /* do all mods */
break; break;
} /* end if */ } /* end if */
} /* end for */ } /* end for */
if (mptr->mask == 0) { /* no match? */ if (!mptr || (mptr->mask == 0)) { /* no match? */
if (shtb && (shptr = find_shtab (shtb, gbuf))) /* global match? */ if (shtb && (shptr = find_shtab (shtb, gbuf))) {/* global match? */
shptr->action (ofile, dptr, uptr, shptr->arg, cptr); t_stat r;
else return SCPE_ARG;
r = shptr->action (ofile, dptr, uptr, shptr->arg, cptr);
if (r != SCPE_OK)
return r;
}
else if (!dptr->modifiers) /* no modifiers? */
return SCPE_NOPARAM;
else
return SCPE_NXPAR;
} /* end if */ } /* end if */
} /* end while */ } /* end while */
return SCPE_OK; return SCPE_OK;