getstat-posix.c - scc - simple c99 compiler
(HTM) git clone git://git.simple-cc.org/scc
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
getstat-posix.c (371B)
---
1 #include <sys/stat.h>
2
3 #include <limits.h>
4 #include <time.h>
5
6 #include <scc/scc.h>
7
8 int
9 getstat(char *fname, struct fprop *prop)
10 {
11 struct stat st;
12
13 if (stat(fname, &st) < 0)
14 return -1;
15 if (st.st_size > LONG_MAX)
16 return -1;
17 prop->uid = st.st_uid;
18 prop->gid = st.st_gid;
19 prop->mode = st.st_mode;
20 prop->time = st.st_mtime;
21 prop->size = st.st_size;
22
23 return 0;
24 }