2 * (c) The University of Glasgow 2002
4 * Directory Runtime Support
8 #if defined(mingw32_TARGET_OS)
13 * read an entry from the directory stream; opt for the
14 * re-entrant friendly way of doing this, if available.
17 __hscore_readdir( HsAddr dirPtr
, HsAddr pDirEnt
)
19 struct dirent
**pDirE
= (struct dirent
**)pDirEnt
;
23 static unsigned int nm_max
= -1;
30 nm_max
= NAME_MAX
+ 1;
32 nm_max
= pathconf(".", _PC_NAME_MAX
);
33 if (nm_max
== -1) { nm_max
= 255; }
37 p
= (struct dirent
*)malloc(sizeof(struct dirent
) + nm_max
);
38 if (p
== NULL
) return -1;
39 res
= readdir_r((DIR*)dirPtr
, p
, pDirE
);
51 *pDirE
= readdir((DIR*)dirPtr
);