summaryrefslogtreecommitdiff
path: root/v4.0/src/INC/DPB.C
blob: e6ce8b9f64d7ed51fb49cbb45137a769b3161ebb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* dpb.c - retrieve DPB for physical drive */

#include "types.h"
#include "sysvar.h"
#include "dpb.h"
#include "cds.h"

extern char NoMem[], ParmNum[], BadParm[] ;
extern struct sysVarsType SysVars ;


/* Walk the DPB list trying to find the appropriate DPB */

long GetDPB(i)
int i ;
{
        struct DPBType DPB ;
        struct DPBType *pd = &DPB ;
        struct DPBType far *dptr ;
        int j ;

        *(long *)(&dptr) = DPB.nextDPB = SysVars.pDPB ;
        DPB.drive = -1 ;

        while (DPB.drive != i) {
                if ((int)DPB.nextDPB == -1)
                        return -1L ;

                *(long *)(&dptr) = DPB.nextDPB ;

                for (j=0 ; j < sizeof(DPB) ; j++)
                         *((char *)pd+j) = *((char far *)dptr+j) ;

        } ;
        return (long)dptr ;
}