Added new functions:
- dir.h: mkdir, rmdir, chdir
- dirent.h:  alphasort, opendir, closedir, readdir, rewinddir, seekdir, telldir, scandir

git-svn-id: svn://kolibrios.org@8759 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat
2021-06-02 00:58:56 +00:00
parent f80f4030c2
commit 2287b1e29b
15 changed files with 360 additions and 19 deletions

View File

@@ -7,4 +7,8 @@
#define direct dirent
extern int chdir(char* dir);
extern int rmdir(const char* dir);
extern int mkdir(const char* dir, unsigned fake_mode);
#endif /*_SYS_DIR_H_*/

View File

@@ -8,24 +8,33 @@
extern "C" {
#endif
struct dirent {
char d_namlen;
char d_name[256];
#define DT_DIR 16
#define DT_REG 0
#include <limits.h>
#include <sys/types.h>
struct dirent{
ino_t d_ino;
unsigned d_type;
char d_name[256];
};
typedef struct{
struct dirent* objs;
ino_t pos;
ino_t num_objs;
}DIR;
extern int closedir(DIR *dir);
extern DIR* opendir(const char *path);
extern struct dirent* readdir(DIR *);
extern void rewinddir(DIR *dir);
extern void seekdir(DIR *dir, unsigned pos);
extern unsigned telldir(DIR *dir);
typedef struct
{
// struct systree_info2 fileinfo;
struct dirent entry;
// __u8 bdfeheader[0x20];
// struct bdfe_item bdfebase;
// __u8 bdfename[264];
} DIR;
int closedir(DIR *dirp);
DIR * opendir(const char *_dirname);
struct dirent * readdir(DIR *_dirp);
void rewinddir(DIR *_dirp);
extern int scandir(const char *path, struct dirent ***res, int (*sel)(const struct dirent *), int (*cmp)(const struct dirent **, const struct dirent **));
extern int alphasort(const struct dirent **a, const struct dirent **b);
#ifdef __cplusplus
}