aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/closedir.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/lib/closedir.c')
-rw-r--r--com32/lib/closedir.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/com32/lib/closedir.c b/com32/lib/closedir.c
new file mode 100644
index 00000000..8a0430e6
--- /dev/null
+++ b/com32/lib/closedir.c
@@ -0,0 +1,29 @@
+/*
+ * closedir.c
+ */
+
+#include <dirent.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <com32.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+int closedir(DIR *dir)
+{
+ int rv;
+ com32sys_t regs;
+ if (dir == NULL) {
+ rv = 0;
+ } else {
+ memset(&regs, 0, sizeof regs); /* ?Needed? */
+ regs.eax.w[0] = 0x0022;
+ regs.esi.w[0] = dir->dd_fd;
+ __com32.cs_intcall(0x22, &regs, &regs);
+ free(dir); /* garbage collection? */
+ rv = 0;
+ }
+ return rv;
+}