23 |
#include <cstring> |
#include <cstring> |
24 |
#include <errno.h> |
#include <errno.h> |
25 |
#include <sstream> |
#include <sstream> |
26 |
|
#include <sys/stat.h> |
27 |
|
|
28 |
#include "Exception.h" |
#include "Exception.h" |
29 |
#include "global_private.h" |
#include "global_private.h" |
157 |
} |
} |
158 |
} |
} |
159 |
|
|
|
int stat(const char *path, struct stat *buf) |
|
|
{ |
|
|
struct _finddata_t info; |
|
|
long handle; |
|
|
mode_t mode = 0; |
|
|
|
|
|
if(!buf | !path) |
|
|
return -1; |
|
|
|
|
|
handle = _findfirst(path, &info); |
|
|
if(handle == -1) |
|
|
return -1; |
|
|
_findclose(handle); |
|
|
|
|
|
|
|
|
buf->st_size = info.size; |
|
|
buf->st_atime = info.time_access; |
|
|
buf->st_ctime = info.time_create; |
|
|
|
|
|
|
|
|
/* | dir/regular | systemfile | readonly | write |*/ |
|
|
|
|
|
mode = S_IFREG; |
|
|
if(info.attrib & _A_SUBDIR) mode = S_IFDIR; |
|
|
buf->st_mode = mode; |
|
|
|
|
|
return 0; |
|
|
} |
|
|
|
|
160 |
int dirfd(DIR *dirp) |
int dirfd(DIR *dirp) |
161 |
{ |
{ |
162 |
if (NULL == dirp) |
if (NULL == dirp) |