SCP: Move test for unit disabled to also cover devices with attach routines

This commit is contained in:
Mark Pizzolato 2017-12-05 12:17:23 -08:00
parent f1f8c8550b
commit 133cf727d5

4
scp.c
View file

@ -6026,6 +6026,8 @@ return scp_attach_unit (dptr, uptr, gbuf); /* attach */
t_stat scp_attach_unit (DEVICE *dptr, UNIT *uptr, const char *cptr)
{
if (uptr->flags & UNIT_DIS) /* disabled? */
return SCPE_UDIS;
if (dptr->attach != NULL) /* device routine? */
return dptr->attach (uptr, (CONST char *)cptr); /* call it */
return attach_unit (uptr, (CONST char *)cptr); /* no, std routine */
@ -6037,8 +6039,6 @@ t_stat attach_unit (UNIT *uptr, CONST char *cptr)
{
DEVICE *dptr;
if (uptr->flags & UNIT_DIS) /* disabled? */
return SCPE_UDIS;
if (!(uptr->flags & UNIT_ATTABLE)) /* not attachable? */
return SCPE_NOATT;
if ((dptr = find_dev_from_unit (uptr)) == NULL)