diff options
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -4,6 +4,7 @@ #include <stdlib.h> #include <string.h> #include <sys/stat.h> +#include <unistd.h> #include "runes.h" @@ -103,6 +104,19 @@ void runes_mkdir_p(char *dir) free(dir); } +char *runes_getcwd(void) +{ + char buf[4096]; + + if (getcwd(buf, 4096)) { + return strdup(buf); + } + else { + runes_die("getcwd: %s", strerror(errno)); + return NULL; + } +} + static void runes_vwarn(const char *fmt, va_list ap) { size_t fmt_len; |