From d5b52a1302ef4409424ec0633ccf9bd72359ea32 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 14 May 2016 22:03:43 -0400 Subject: refactor/rewrite the client/server protocol handling also pass the environment and current directory over as well --- src/util.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/util.c') 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 #include #include +#include #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; -- cgit v1.2.3-54-g00ecf