From cf047742092ec25211d95612f22a23fddf08051a Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 11 Nov 2018 10:16:19 +0100 Subject: [PATCH] core: Add getcwd. * src/posix.c (getcwd_): New function. --- src/posix.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/posix.c b/src/posix.c index d8deb3a9..efef1ca7 100644 --- a/src/posix.c +++ b/src/posix.c @@ -19,6 +19,7 @@ */ #include +#include #include #include #include @@ -371,3 +372,11 @@ get_internal_run_time () ts.tv_nsec - g_start_time.tv_nsec); return MAKE_NUMBER (time); } + +SCM +getcwd_ () ///((name . "getcwd")) +{ + char buf[PATH_MAX]; + return MAKE_STRING (cstring_to_list (getcwd (buf, PATH_MAX))); +} +