2023-05-26 22:21:07 +03:00
|
|
|
#ifndef _DIRENT_H
|
|
|
|
#define _DIRENT_H 1
|
2023-03-25 02:08:33 +02:00
|
|
|
|
2023-05-26 22:21:07 +03:00
|
|
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dirent.h.html
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
2023-03-25 02:08:33 +02:00
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
|
2023-05-26 22:21:07 +03:00
|
|
|
#define __need_ino_t
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2023-06-11 00:19:20 +03:00
|
|
|
struct __DIR;
|
|
|
|
typedef struct __DIR DIR;
|
2023-03-25 02:08:33 +02:00
|
|
|
|
2023-09-30 20:34:08 +03:00
|
|
|
#define DT_UNKNOWN 0
|
|
|
|
#define DT_REG 1
|
|
|
|
#define DT_DIR 2
|
|
|
|
#define DT_CHR 3
|
|
|
|
#define DT_BLK 4
|
|
|
|
#define DT_FIFO 5
|
|
|
|
#define DT_SOCK 6
|
|
|
|
#define DT_LNK 7
|
|
|
|
|
2023-03-25 02:08:33 +02:00
|
|
|
struct dirent
|
|
|
|
{
|
2023-09-30 20:34:08 +03:00
|
|
|
ino_t d_ino; /* File serial number. */
|
|
|
|
unsigned char d_type; /* File type. One of DT_* definitions. */
|
|
|
|
char d_name[]; /* Filename string of entry. */
|
2023-03-25 02:08:33 +02:00
|
|
|
};
|
|
|
|
|
2023-05-26 22:21:07 +03:00
|
|
|
int alphasort(const struct dirent** d1, const struct dirent** d2);
|
|
|
|
int closedir(DIR* dirp);
|
|
|
|
int dirfd(DIR* dirp);
|
|
|
|
DIR* fdopendir(int fd);
|
|
|
|
DIR* opendir(const char* dirname);
|
|
|
|
struct dirent* readdir(DIR* dirp);
|
|
|
|
int readdir_r(DIR* __restrict dirp, struct dirent* __restrict entry, struct dirent** __restrict result);
|
|
|
|
void rewinddir(DIR* dirp);
|
|
|
|
int scandir(const char* dir, struct dirent*** namelist, int (*sel)(const struct dirent*), int (*compar)(const struct dirent**, const struct dirent**));
|
|
|
|
void seekdir(DIR* dirp, long loc);
|
|
|
|
long telldir(DIR* dirp);
|
|
|
|
|
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif
|