]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/INC/DPB.C

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / INC / DPB.C
1 /* dpb.c - retrieve DPB for physical drive */
2
3 #include "types.h"
4 #include "sysvar.h"
5 #include "dpb.h"
6 #include "cds.h"
7
8 extern char NoMem[], ParmNum[], BadParm[] ;
9 extern struct sysVarsType SysVars ;
10
11
12 /* Walk the DPB list trying to find the appropriate DPB */
13
14 long GetDPB(i)
15 int i ;
16 {
17 struct DPBType DPB ;
18 struct DPBType *pd = &DPB ;
19 struct DPBType far *dptr ;
20 int j ;
21
22 *(long *)(&dptr) = DPB.nextDPB = SysVars.pDPB ;
23 DPB.drive = -1 ;
24
25 while (DPB.drive != i) {
26 if ((int)DPB.nextDPB == -1)
27 return -1L ;
28
29 *(long *)(&dptr) = DPB.nextDPB ;
30
31 for (j=0 ; j < sizeof(DPB) ; j++)
32 *((char *)pd+j) = *((char far *)dptr+j) ;
33
34 } ;
35 return (long)dptr ;
36 }
37
38 \1a