11 DIR* __fastcall__ opendir (const char*)
13 unsigned char buffer[8+16+1+7];
18 /* Setup file name and offset */
23 /* Open the directory on disk for reading */
24 d.fd = open (d.name, O_RDONLY);
27 /* Skip the disk header */
28 count = read (d.fd, buffer, sizeof (buffer));
29 if (count == sizeof (buffer)) {
31 /* Allocate memory for the DIR structure returned */
32 dir = malloc (sizeof (*dir));
34 /* Copy the contents of d */
36 memcpy (dir, &d, sizeof (d));
38 /* Set an appropriate error code */
41 } else if (count >= 0) {
42 /* Short read - need to set an error code */