aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2016-05-14 22:03:43 -0400
committerJesse Luehrs <doy@tozt.net>2016-05-14 22:03:43 -0400
commitd5b52a1302ef4409424ec0633ccf9bd72359ea32 (patch)
tree76d90c6b51f8bf234cc19cce75147d6089a1b808 /src/util.c
parentbfe96a6aa5fa3ca9a05b658efbcaee9dc01b5235 (diff)
downloadrunes-d5b52a1302ef4409424ec0633ccf9bd72359ea32.tar.gz
runes-d5b52a1302ef4409424ec0633ccf9bd72359ea32.zip
refactor/rewrite the client/server protocol handling
also pass the environment and current directory over as well
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;