SCP: Add HELP SET/SHOW for unit specific commands for DEVICEs with single units
This commit is contained in:
parent
65542cd46d
commit
1a54a2515d
1 changed files with 40 additions and 19 deletions
59
scp.c
59
scp.c
|
@ -3248,12 +3248,19 @@ t_bool found = FALSE;
|
|||
t_bool deb_desc_available = FALSE;
|
||||
char buf[CBUFSIZE], header[CBUFSIZE];
|
||||
uint32 enabled_units = dptr->numunits;
|
||||
uint32 unit;
|
||||
char unit_spec[50];
|
||||
uint32 unit, found_unit = 0;
|
||||
|
||||
sprintf (header, "\n%s device SET commands:\n\n", dptr->name);
|
||||
for (unit=0; unit < dptr->numunits; unit++)
|
||||
if (dptr->units[unit].flags & UNIT_DIS)
|
||||
--enabled_units;
|
||||
else
|
||||
found_unit = unit;
|
||||
if (enabled_units == 1)
|
||||
snprintf (unit_spec, sizeof (unit_spec), "%s%u", sim_dname (dptr), found_unit);
|
||||
else
|
||||
snprintf (unit_spec, sizeof (unit_spec), "%sn", sim_dname (dptr));
|
||||
if (dptr->modifiers) {
|
||||
for (mptr = dptr->modifiers; mptr->mask != 0; mptr++) {
|
||||
if (!MODMASK(mptr,MTAB_VDV) && MODMASK(mptr,MTAB_VUN) && (dptr->numunits != 1))
|
||||
|
@ -3299,34 +3306,33 @@ if ((dptr->flags & DEV_DEBUG) || (dptr->debflags)) {
|
|||
fprintf (st, "%-30s\tDisables specific debugging for device %s\n", buf, sim_dname (dptr));
|
||||
}
|
||||
}
|
||||
if ((dptr->modifiers) && (dptr->units) && (enabled_units != 1)) {
|
||||
if ((dptr->modifiers) && (dptr->units)) { /* handle unit specific modifiers */
|
||||
if (dptr->units->flags & UNIT_DISABLE) {
|
||||
fprint_header (st, &found, header);
|
||||
sprintf (buf, "set %sn ENABLE", sim_dname (dptr));
|
||||
fprintf (st, "%-30s\tEnables unit %sn\n", buf, sim_dname (dptr));
|
||||
sprintf (buf, "set %sn DISABLE", sim_dname (dptr));
|
||||
fprintf (st, "%-30s\tDisables unit %sn\n", buf, sim_dname (dptr));
|
||||
sprintf (buf, "set %s ENABLE", unit_spec);
|
||||
fprintf (st, "%-30s\tEnables unit %s\n", buf, unit_spec);
|
||||
sprintf (buf, "set %s DISABLE", unit_spec);
|
||||
fprintf (st, "%-30s\tDisables unit %sn\n", buf, unit_spec);
|
||||
}
|
||||
if (((dptr->flags & DEV_DEBUG) || (dptr->debflags)) &&
|
||||
((DEV_TYPE(dptr) == DEV_DISK) || (DEV_TYPE(dptr) == DEV_TAPE))) {
|
||||
sprintf (buf, "set %sn DEBUG", sim_dname (dptr));
|
||||
fprintf (st, "%-30s\tEnables debugging for device unit %sn\n", buf, sim_dname (dptr));
|
||||
sprintf (buf, "set %sn NODEBUG", sim_dname (dptr));
|
||||
fprintf (st, "%-30s\tDisables debugging for device unit %sn\n", buf, sim_dname (dptr));
|
||||
sprintf (buf, "set %s DEBUG", unit_spec);
|
||||
fprintf (st, "%-30s\tEnables debugging for device unit %s\n", buf, unit_spec);
|
||||
sprintf (buf, "set %s NODEBUG", unit_spec);
|
||||
fprintf (st, "%-30s\tDisables debugging for device unit %s\n", buf, unit_spec);
|
||||
if (dptr->debflags) {
|
||||
strcpy (buf, "");
|
||||
fprintf (st, "set %sn DEBUG=", sim_dname (dptr));
|
||||
fprintf (st, "set %s DEBUG=", unit_spec);
|
||||
for (dep = dptr->debflags; dep->name != NULL; dep++)
|
||||
fprintf (st, "%s%s", ((dep == dptr->debflags) ? "" : ";"), dep->name);
|
||||
fprintf (st, "\n");
|
||||
fprintf (st, "%-30s\tEnables specific debugging for device unit %sn\n", buf, sim_dname (dptr));
|
||||
fprintf (st, "set %sn NODEBUG=", sim_dname (dptr));
|
||||
fprintf (st, "%-30s\tEnables specific debugging for device unit %s\n", buf, unit_spec);
|
||||
fprintf (st, "set %s NODEBUG=", unit_spec);
|
||||
for (dep = dptr->debflags; dep->name != NULL; dep++)
|
||||
fprintf (st, "%s%s", ((dep == dptr->debflags) ? "" : ";"), dep->name);
|
||||
fprintf (st, "\n");
|
||||
fprintf (st, "%-30s\tDisables specific debugging for device unit %sn\n", buf, sim_dname (dptr));
|
||||
fprintf (st, "%-30s\tDisables specific debugging for device unit %s\n", buf, unit_spec);
|
||||
}
|
||||
|
||||
}
|
||||
for (mptr = dptr->modifiers; mptr->mask != 0; mptr++) {
|
||||
if ((!MODMASK(mptr,MTAB_VUN)) && MODMASK(mptr,MTAB_XTD))
|
||||
|
@ -3335,7 +3341,7 @@ if ((dptr->modifiers) && (dptr->units) && (enabled_units != 1)) {
|
|||
continue; /* skip show only modifiers */
|
||||
if (mptr->mstring) {
|
||||
fprint_header (st, &found, header);
|
||||
sprintf (buf, "set %s%s %s%s", sim_dname (dptr), (dptr->numunits > 1) ? "n" : "0", mptr->mstring, (strchr(mptr->mstring, '=')) ? "" : (MODMASK(mptr,MTAB_VALR) ? "=val" : (MODMASK(mptr,MTAB_VALO) ? "{=val}": "")));
|
||||
sprintf (buf, "set %s %s%s", unit_spec, mptr->mstring, (strchr(mptr->mstring, '=')) ? "" : (MODMASK(mptr,MTAB_VALR) ? "=val" : (MODMASK(mptr,MTAB_VALO) ? "{=val}": "")));
|
||||
fprintf (st, "%-30s\t%s\n", buf, (strchr (mptr->mstring, '=')) ? ((strlen (buf) > 30) ? "" : mptr->help) : (mptr->help ? mptr->help : ""));
|
||||
if ((strchr (mptr->mstring, '=')) && (strlen (buf) > 30))
|
||||
fprintf (st, "%-30s\t%s\n", "", mptr->help);
|
||||
|
@ -3372,12 +3378,21 @@ MTAB *mptr;
|
|||
t_bool found = FALSE;
|
||||
char buf[CBUFSIZE], header[CBUFSIZE];
|
||||
uint32 enabled_units = dptr->numunits;
|
||||
uint32 unit;
|
||||
char unit_spec[50];
|
||||
uint32 unit, found_unit = 0;
|
||||
|
||||
sprintf (header, "\n%s device SHOW commands:\n\n", dptr->name);
|
||||
for (unit=0; unit < dptr->numunits; unit++)
|
||||
if (dptr->units[unit].flags & UNIT_DIS)
|
||||
--enabled_units;
|
||||
else
|
||||
found_unit = unit;
|
||||
if (enabled_units == 1)
|
||||
snprintf (unit_spec, sizeof (unit_spec), "%s%u", sim_dname (dptr), found_unit);
|
||||
else
|
||||
snprintf (unit_spec, sizeof (unit_spec), "%sn", sim_dname (dptr));
|
||||
snprintf (unit_spec, sizeof (unit_spec), "%s%s", sim_dname (dptr),
|
||||
((enabled_units == 1) && ((dptr->units[0].flags & UNIT_DIS) == 0)) ? "0" : "n");
|
||||
if (dptr->modifiers) {
|
||||
for (mptr = dptr->modifiers; mptr->mask != 0; mptr++) {
|
||||
if (!MODMASK(mptr,MTAB_VDV) && MODMASK(mptr,MTAB_VUN) && (dptr->numunits != 1))
|
||||
|
@ -3396,14 +3411,20 @@ if ((dptr->flags & DEV_DEBUG) || (dptr->debflags)) {
|
|||
sprintf (buf, "show %s DEBUG", sim_dname (dptr));
|
||||
fprintf (st, "%-30s\tDisplays debugging status for device %s\n", buf, sim_dname (dptr));
|
||||
}
|
||||
if ((dptr->modifiers) && (dptr->units) && (enabled_units != 1)) {
|
||||
if (((dptr->flags & DEV_DEBUG) || (dptr->debflags)) &&
|
||||
((DEV_TYPE(dptr) == DEV_DISK) || (DEV_TYPE(dptr) == DEV_TAPE))) {
|
||||
sprintf (buf, "show %s DEBUG", unit_spec);
|
||||
fprintf (st, "%-30s\tDisplays debugging status for device unit %s\n", buf, unit_spec);
|
||||
}
|
||||
|
||||
if ((dptr->modifiers) && (dptr->units)) { /* handle unit specific modifiers */
|
||||
for (mptr = dptr->modifiers; mptr->mask != 0; mptr++) {
|
||||
if ((!MODMASK(mptr,MTAB_VUN)) && MODMASK(mptr,MTAB_XTD))
|
||||
continue; /* skip device only modifiers */
|
||||
if ((!mptr->disp) || (!mptr->pstring))
|
||||
continue;
|
||||
fprint_header (st, &found, header);
|
||||
sprintf (buf, "show %s%s %s%s", sim_dname (dptr), (dptr->numunits > 1) ? "n" : "0", mptr->pstring, MODMASK(mptr,MTAB_SHP) ? "=arg" : "");
|
||||
sprintf (buf, "show %s %s%s", unit_spec, mptr->pstring, MODMASK(mptr,MTAB_SHP) ? "=arg" : "");
|
||||
fprintf (st, "%-30s\t%s\n", buf, mptr->help ? mptr->help : "");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue