#include #include #if defined(__APPLE__) && !defined(__aarch64__) DIR * opendir$INODE64( const char * dirName ); struct dirent * readdir$INODE64( DIR * dir ); #define opendir opendir$INODE64 #define readdir readdir$INODE64 #endif int c_is_dir(const char *path) { struct stat m; int r = stat(path, &m); return r == 0 && S_ISDIR(m.st_mode); } const char *get_d_name(struct dirent *d) { return (const char *) d->d_name; } DIR *c_opendir(const char *dirname) { return opendir(dirname); } struct dirent *c_readdir(DIR *dirp) { return readdir(dirp); }