diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2003-03-03 17:16:15 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2003-03-03 17:16:15 +0000 |
commit | 859efb84a8160e694b35a90fd60fcb3606ca8ef9 (patch) | |
tree | d09e19f7742c3914e33e92e56451a5021ba1740a /byterun/sys.c | |
parent | dc64ea8cc7ed73b7b67f8554f29b95575883b81b (diff) |
Ajout de Sys.readdir
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5415 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/sys.c')
-rw-r--r-- | byterun/sys.c | 14 |
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); +} |