aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index 8737f11..c663710 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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;