begin work on parsing library
This commit is contained in:
parent
607cac9b42
commit
76a2390861
2 changed files with 30 additions and 0 deletions
21
parsebin/file.c
Normal file
21
parsebin/file.c
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#define _USE_GNU
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifndef WIN32
|
||||
# include <unistd.h>
|
||||
#else
|
||||
# define stat _stat
|
||||
#endif
|
||||
|
||||
// ssize_t abspath(const char *restrict path, char *restrict buf)
|
||||
|
||||
int get_mod_time(const char *restrict path, struct timespec *restrict mtime) {
|
||||
struct stat result;
|
||||
if(stat(path, &result) == -1)
|
||||
return ERR;
|
||||
*mtime = result.st_mtime;
|
||||
|
||||
return OK;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue