diff options
Diffstat (limited to 'src/sys/stat/stat.c')
| -rw-r--r-- | src/sys/stat/stat.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/sys/stat/stat.c b/src/sys/stat/stat.c new file mode 100644 index 00000000..c5079295 --- /dev/null +++ b/src/sys/stat/stat.c @@ -0,0 +1,32 @@ +#include "sys/types.h" +#include <sys/stat.h> +#include "stdlib.h" +#include "nonstd/assert.h" + +int stat(const char * restrict path, struct stat * restrict buf) +{ + ASSERT_NONNULL(path); + ASSERT_NONNULL(buf); + + int ret = 0; + #if 0 + char *linkbuf = NULL; + + do { + ret = lstat(path, buf); + if (S_ISLNK(buf->st_mode)) { + linkbuf = realloc(linkbuf, buf->st_size + 1); + readlink(path, linkbuf, buf->st_size); + path = linkbuf; + } else { + path = NULL; + } + } while (path); + realloc(linkbuf, 0); + #endif + + return ret; +} +/* +POSIX(1) +*/ |
