2021-04-27 18:33:31 +02:00
|
|
|
/* Copyright (C) 2021 Logaev Maxim (turbocat2001), GPLv2 */
|
|
|
|
|
|
|
|
#ifndef _DIRENT_H_
|
|
|
|
#define _DIRENT_H_
|
|
|
|
|
|
|
|
#include <limits.h>
|
2022-04-15 11:11:49 +02:00
|
|
|
#include <stddef.h>
|
2021-04-27 18:33:31 +02:00
|
|
|
|
|
|
|
#define IS_FOLDER 16
|
2022-04-15 11:11:49 +02:00
|
|
|
#define IS_FILE 0
|
2021-04-27 18:33:31 +02:00
|
|
|
|
|
|
|
typedef unsigned ino_t;
|
|
|
|
|
2022-04-15 11:11:49 +02:00
|
|
|
struct dirent {
|
|
|
|
ino_t d_ino; //File serial number.
|
|
|
|
char d_name[PATH_MAX]; // Name of entry.
|
|
|
|
unsigned d_type;
|
2021-04-27 18:33:31 +02:00
|
|
|
};
|
|
|
|
|
2022-04-15 11:11:49 +02:00
|
|
|
typedef struct {
|
|
|
|
struct dirent* objs;
|
2021-04-27 18:33:31 +02:00
|
|
|
ino_t pos;
|
2022-04-15 11:11:49 +02:00
|
|
|
ino_t num_objs;
|
|
|
|
} DIR;
|
|
|
|
|
2022-05-10 20:58:40 +02:00
|
|
|
DLLAPI int closedir(DIR* dir);
|
|
|
|
DLLAPI DIR* opendir(const char* path);
|
|
|
|
DLLAPI struct dirent* readdir(DIR*);
|
|
|
|
DLLAPI void rewinddir(DIR* dir);
|
|
|
|
DLLAPI void seekdir(DIR* dir, unsigned pos);
|
|
|
|
DLLAPI unsigned telldir(DIR* dir);
|
2021-04-27 18:33:31 +02:00
|
|
|
|
2021-05-23 17:28:07 +02:00
|
|
|
#endif // _DIRENT_H_
|