DISK: Ignore NULL unit with HELP <dev> ATTACH for disk devices

Related to activities in #801
This commit is contained in:
Mark Pizzolato 2020-02-10 10:41:33 -08:00
parent a562c8727b
commit e333a691d0

View file

@ -2593,40 +2593,36 @@ fprintf (st, "was created. This metadata is therefore available whenever that V
fprintf (st, "attached to an emulated disk device in the future so the device type and\n"); fprintf (st, "attached to an emulated disk device in the future so the device type and\n");
fprintf (st, "size can be automatically be configured.\n\n"); fprintf (st, "size can be automatically be configured.\n\n");
if (0 == (uptr-dptr->units)) { if (dptr->numunits > 1) {
if (dptr->numunits > 1) { uint32 i, attachable_count = 0, out_count = 0, skip_count;
uint32 i, attachable_count = 0, out_count = 0, skip_count;
for (i=0; i < dptr->numunits; ++i) for (i=0; i < dptr->numunits; ++i)
if ((dptr->units[i].flags & UNIT_ATTABLE) && if ((dptr->units[i].flags & UNIT_ATTABLE) &&
!(dptr->units[i].flags & UNIT_DIS)) !(dptr->units[i].flags & UNIT_DIS))
++attachable_count; ++attachable_count;
for (i=0; (i < dptr->numunits) && (out_count < 2); ++i) for (i=0; (i < dptr->numunits) && (out_count < 2); ++i)
if ((dptr->units[i].flags & UNIT_ATTABLE) && if ((dptr->units[i].flags & UNIT_ATTABLE) &&
!(dptr->units[i].flags & UNIT_DIS)) { !(dptr->units[i].flags & UNIT_DIS)) {
fprintf (st, " sim> ATTACH {switches} %s%d diskfile\n", dptr->name, i); fprintf (st, " sim> ATTACH {switches} %s%d diskfile\n", dptr->name, i);
++out_count; ++out_count;
}
if (attachable_count > 4) {
fprintf (st, " .\n");
fprintf (st, " .\n");
fprintf (st, " .\n");
} }
skip_count = attachable_count - 2; if (attachable_count > 4) {
for (i=0; i < dptr->numunits; ++i) fprintf (st, " .\n");
if ((dptr->units[i].flags & UNIT_ATTABLE) && fprintf (st, " .\n");
!(dptr->units[i].flags & UNIT_DIS)) { fprintf (st, " .\n");
if (skip_count == 0)
fprintf (st, " sim> ATTACH {switches} %s%d diskfile\n", dptr->name, i);
else
--skip_count;
}
} }
else skip_count = attachable_count - 2;
fprintf (st, " sim> ATTACH {switches} %s diskfile\n", dptr->name); for (i=0; i < dptr->numunits; ++i)
if ((dptr->units[i].flags & UNIT_ATTABLE) &&
!(dptr->units[i].flags & UNIT_DIS)) {
if (skip_count == 0)
fprintf (st, " sim> ATTACH {switches} %s%d diskfile\n", dptr->name, i);
else
--skip_count;
}
} }
else else
fprintf (st, " sim> ATTACH {switches} %s diskfile\n\n", dptr->name); fprintf (st, " sim> ATTACH {switches} %s diskfile\n", dptr->name);
fprintf (st, "\n%s attach command switches\n", dptr->name); fprintf (st, "\n%s attach command switches\n", dptr->name);
fprintf (st, " -R Attach Read Only.\n"); fprintf (st, " -R Attach Read Only.\n");
fprintf (st, " -E Must Exist (if not specified an attempt to create the indicated\n"); fprintf (st, " -E Must Exist (if not specified an attempt to create the indicated\n");