aboutsummaryrefslogtreecommitdiff
path: root/src/c.c
blob: 7075f4232bdf3364940d6304e2baf81e6830be1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <sys/stat.h>
#include <dirent.h>

#ifdef __APPLE__
DIR * opendir$INODE64( const char * dirName );
struct dirent * readdir$INODE64( DIR * dir );
#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){

#ifdef __APPLE__
    return opendir$INODE64(dirname);
#else
    return opendir(dirname);
#endif

}

struct dirent *c_readdir(DIR *dirp){

#ifdef __APPLE__
    return readdir$INODE64(dirp);
#else
    return readdir(dirp);
#endif

}