blob: 9f25cbf6faa9777d79b351b1e7fb5b638b554461 (
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
|
#ifndef DIRENT_H
#define DIRENT_H
#include <fcntl.h>
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#define S_ISREG(_m) (_m & (STAT_REG))
#define S_ISDIR(_m) (_m & (STAT_DIR))
struct dirent {
ino_t d_ino; // File serial number.
char d_name[PATH_MAX]; // Filename string of entry.
};
typedef struct {
int fd;
struct dirent internal_direntry;
int dir_num;
} DIR;
DIR *opendir(const char *dirname);
struct dirent *readdir(DIR *dir);
int closedir(DIR *dirp);
int alphasort(const struct dirent **d1, const struct dirent **d2);
int scandir(const char *dir, struct dirent ***namelist,
int (*sel)(const struct dirent *),
int (*compar)(const struct dirent **, const struct dirent **));
#endif
|