diff options
Diffstat (limited to 'newlib/libc/sys/linux/getwd.c')
-rw-r--r-- | newlib/libc/sys/linux/getwd.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/newlib/libc/sys/linux/getwd.c b/newlib/libc/sys/linux/getwd.c new file mode 100644 index 000000000..72db33830 --- /dev/null +++ b/newlib/libc/sys/linux/getwd.c @@ -0,0 +1,20 @@ +#include <string.h> +#include <unistd.h> +#include <errno.h> + +char * +getwd (char *buf) +{ + char tmp[MAXPATHLEN]; + + if (buf == NULL) + { + errno = EINVAL; + return NULL; + } + + if (getcwd (tmp, MAXPATHLEN) == NULL) + return NULL; + + return strncpy (buf, tmp, MAXPATHLEN); +} |