summaryrefslogtreecommitdiff
path: root/src/dirent
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-02-09 13:14:01 -0500
committerJakob Kaivo <jkk@ung.org>2019-02-09 13:14:01 -0500
commit253a32e2f9ff1cbb8edbe7c79834a678daebeb93 (patch)
tree599cf5baf01c6dae33a2f89989b08b7d553f7fd0 /src/dirent
parent88d0b5e7ffbf0554b236dc46225846061b5f4817 (diff)
merge POSIX.1-1988/1990
Diffstat (limited to 'src/dirent')
-rw-r--r--src/dirent/DIR.c5
-rw-r--r--src/dirent/closedir.c20
-rw-r--r--src/dirent/opendir.c12
-rw-r--r--src/dirent/readdir.c12
-rw-r--r--src/dirent/rewinddir.c10
-rw-r--r--src/dirent/struct_dirent.c14
6 files changed, 73 insertions, 0 deletions
diff --git a/src/dirent/DIR.c b/src/dirent/DIR.c
new file mode 100644
index 00000000..cc43a5d8
--- /dev/null
+++ b/src/dirent/DIR.c
@@ -0,0 +1,5 @@
+#include <dirent.h>
+typedef struct __DIR DIR;
+/*
+POSIX(1)
+*/
diff --git a/src/dirent/closedir.c b/src/dirent/closedir.c
new file mode 100644
index 00000000..daa72d50
--- /dev/null
+++ b/src/dirent/closedir.c
@@ -0,0 +1,20 @@
+#include <dirent.h>
+#include "nonstd/assert.h"
+#include "nonstd/types.h"
+#include "nonstd/syscall.h"
+
+int closedir(DIR *dirp)
+{
+ ASSERT_NONNULL(dirp);
+ SCNO(scno, "closedir", -1);
+
+ int r = __libc.syscall(scno, dirp);
+ if (r < 0) {
+ errno = -r;
+ return -1;
+ }
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/dirent/opendir.c b/src/dirent/opendir.c
new file mode 100644
index 00000000..3e1d1c87
--- /dev/null
+++ b/src/dirent/opendir.c
@@ -0,0 +1,12 @@
+#include <dirent.h>
+#include "stddef.h"
+
+DIR * opendir(const char * dirname)
+{
+ (void)dirname;
+ return NULL;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/dirent/readdir.c b/src/dirent/readdir.c
new file mode 100644
index 00000000..0e079f82
--- /dev/null
+++ b/src/dirent/readdir.c
@@ -0,0 +1,12 @@
+#include <dirent.h>
+#include "stddef.h"
+
+struct dirent * readdir(DIR * dirp)
+{
+ (void)dirp;
+ return NULL;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/dirent/rewinddir.c b/src/dirent/rewinddir.c
new file mode 100644
index 00000000..0b53d783
--- /dev/null
+++ b/src/dirent/rewinddir.c
@@ -0,0 +1,10 @@
+#include <dirent.h>
+
+void rewinddir(DIR * dirp)
+{
+ (void)dirp;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/dirent/struct_dirent.c b/src/dirent/struct_dirent.c
new file mode 100644
index 00000000..a6d4bb6c
--- /dev/null
+++ b/src/dirent/struct_dirent.c
@@ -0,0 +1,14 @@
+#include <dirent.h>
+
+struct dirent {
+ #if (defined _XOPEN_SOURCE)
+ ino_t d_ino;
+ #else
+ unsigned long long int __padding;
+ #endif
+ char d_name[];
+};
+
+/*
+POSIX(1)
+*/