2 ** Ullrich von Bassewitz, 2012-05-30. Based on code by Groepaz.
14 DIR* __fastcall__ opendir (register const char* name)
20 /* Setup the actual file name that is sent to the disk. We accept "0:",
21 ** "1:" and "." as directory names.
24 if (name == 0 || name[0] == '\0' || (name[0] == '.' && name[1] == '\0')) {
26 } else if ((name[0] == '0' || name[0] == '1') && name[1] == ':' && name[2] == '\0') {
34 /* Set the offset of the first entry */
37 /* Open the directory on disk for reading */
38 d.fd = open (d.name, O_RDONLY);
41 /* Skip the load address */
42 if (_dirread (&d, buf, sizeof (buf))) {
44 /* Allocate memory for the DIR structure returned */
45 dir = malloc (sizeof (*dir));
47 /* Copy the contents of d */
49 memcpy (dir, &d, sizeof (d));
51 /* Set an appropriate error code */