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 059fb2e27f
commit cf04774209
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 9 additions and 0 deletions

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)));
}