Skip to content
Snippets Groups Projects
Commit 5152448a authored by rswindell's avatar rswindell
Browse files

Moved getfattr from msdirent.c to wrappers.c

parent c94a095e
No related branches found
No related tags found
No related merge requests found
......@@ -88,15 +88,3 @@ void rewinddir(DIR* dir)
dir->end=FALSE;
dir->handle=_findfirst(dir->filespec,&dir->finddata);
}
int getfattr(char* filename)
{
long handle;
struct _finddata_t finddata;
if((handle=_findfirst(filename,&finddata))==-1) {
errno=ENOENT;
return(-1);
}
_findclose(handle);
return(finddata.attrib);
}
\ No newline at end of file
......@@ -73,8 +73,6 @@ struct dirent * readdir (DIR *__dir);
int closedir (DIR *__dir);
void rewinddir(DIR *__dir);
int getfattr(char* filename);
#ifdef __cplusplus
}
#endif
......
......@@ -119,6 +119,7 @@ DLLEXPORT char* ultoa(ulong, char*, int radix);
DLLEXPORT BOOL fexist(char *filespec);
DLLEXPORT long flength(char *filename);
DLLEXPORT long fdate(char *filename);
DLLEXPORT int getfattr(char* filename);
DLLEXPORT ulong getfreediskspace(char* path);
#ifdef __cplusplus
......
......@@ -55,6 +55,7 @@
#include <stdio.h> /* sprintf */
#include <stdlib.h> /* rand */
#include <errno.h> /* ENOENT definitions */
#include "gen_defs.h" /* BOOL */
#include "sbbswrap.h" /* verify prototypes */
......@@ -131,6 +132,33 @@ long fdate(char *filename)
return(st.st_mtime);
}
/****************************************************************************/
/* Returns the attributes (mode) for specified 'filename' */
/****************************************************************************/
int getfattr(char* filename)
{
#ifdef _WIN32
long handle;
struct _finddata_t finddata;
if((handle=_findfirst(filename,&finddata))==-1) {
errno=ENOENT;
return(-1);
}
_findclose(handle);
return(finddata.attrib);
#else
STAT st;
if(stat(filename, &st)!=0) {
errno=ENOENT;
return(-1L);
}
return(st.st_mode);
#endif
}
/****************************************************************************/
/* Returns the length of the file in 'fd' */
/****************************************************************************/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment