dav/system.h

changeset 611
a7c48e0dca88
parent 608
3e4c0285a868
child 789
378b5ab86f77
equal deleted inserted replaced
610:aa3baf1dd81b 611:a7c48e0dca88
55 SysDirEnt *ent; 55 SysDirEnt *ent;
56 }; 56 };
57 #define SYS_DIR struct WinDir* 57 #define SYS_DIR struct WinDir*
58 #define SYS_STAT struct __stat64 58 #define SYS_STAT struct __stat64
59 59
60 #define S_ISLNK(s) 0
61
62 typedef int uid_t; 60 typedef int uid_t;
63 typedef int gid_t; 61 typedef int gid_t;
62
63 #define SYS_ISLINK(path, mode) sys_islink(path)
64 #define SYS_LINK_EXT ".lnk"
64 65
65 #else 66 #else
66 67
67 typedef struct SysDir { 68 typedef struct SysDir {
68 DIR *dir; 69 DIR *dir;
69 SysDirEnt *ent; 70 SysDirEnt *ent;
70 } SysDir; 71 } SysDir;
71 72
72 #define SYS_DIR SysDir* 73 #define SYS_DIR SysDir*
73 #define SYS_STAT struct stat 74 #define SYS_STAT struct stat
75
76 #define SYS_ISLINK(p, s) S_ISLNK(s.st_mode)
77
74 #endif 78 #endif
75 79
76 typedef int(*stat_func)(const char*, SYS_STAT *); 80 typedef int(*stat_func)(const char*, SYS_STAT *);
81
82 void sys_init(void);
83 void sys_uninit(void);
77 84
78 void sys_freedirent(SysDirEnt *ent); 85 void sys_freedirent(SysDirEnt *ent);
79 SYS_DIR sys_opendir(const char *path); 86 SYS_DIR sys_opendir(const char *path);
80 SysDirEnt* sys_readdir(SYS_DIR dir); 87 SysDirEnt* sys_readdir(SYS_DIR dir);
81 void sys_closedir(SYS_DIR dir); 88 void sys_closedir(SYS_DIR dir);
83 FILE* sys_fopen(const char *path, const char *mode); 90 FILE* sys_fopen(const char *path, const char *mode);
84 91
85 int sys_stat(const char *path, SYS_STAT *s); 92 int sys_stat(const char *path, SYS_STAT *s);
86 int sys_lstat(const char *path, SYS_STAT *s); 93 int sys_lstat(const char *path, SYS_STAT *s);
87 94
95 int sys_islink(const char *path);
96
88 int sys_rename(const char *oldpath, const char *newpath); 97 int sys_rename(const char *oldpath, const char *newpath);
89 int sys_unlink(const char *path); 98 int sys_unlink(const char *path);
90 int sys_mkdir(const char *path); 99 int sys_mkdir(const char *path);
91 100
92 ssize_t sys_readlink(const char *path, char *buffer, size_t size); 101 char* sys_readlink(const char *path, SYS_STAT *s);
93 102
94 int sys_symlink(const char *target, const char *linkpath); 103 int sys_symlink(const char *target, const char *linkpath);
95 104
96 #ifdef __cplusplus 105 #ifdef __cplusplus
97 } 106 }

mercurial