summaryrefslogtreecommitdiffstats
path: root/byterun/sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'byterun/sys.c')
-rw-r--r--byterun/sys.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/byterun/sys.c b/byterun/sys.c
index e0f8ec8bd..01184b908 100644
--- a/byterun/sys.c
+++ b/byterun/sys.c
@@ -47,6 +47,7 @@
#include "fail.h"
#include "instruct.h"
#include "mlvalues.h"
+#include "osdeps.h"
#include "signals.h"
#include "stacks.h"
#include "sys.h"
@@ -336,3 +337,16 @@ CAMLprim value sys_get_config(value unit)
CAMLreturn (result);
}
+CAMLprim value sys_read_directory(value path)
+{
+ CAMLparam1(path);
+ CAMLlocal1(result);
+ struct ext_table tbl;
+
+ ext_table_init(&tbl, 50);
+ if (caml_read_directory(String_val(path), &tbl) == -1) sys_error(path);
+ ext_table_add(&tbl, NULL);
+ result = copy_string_array((char const **) tbl.contents);
+ ext_table_free(&tbl, 1);
+ CAMLreturn(result);
+}