core: Add getcwd.

* src/posix.c (getcwd_): New function.
This commit is contained in:
Jan Nieuwenhuizen 2018-11-11 10:16:19 +01:00
parent 7d2e0f1215
commit 7c63d3df47
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -19,6 +19,7 @@
*/
#include <fcntl.h>
#include <limits.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/time.h>
@ -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)));
}