diff options
author | Jesse Luehrs <doy@tozt.net> | 2016-05-14 22:03:43 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2016-05-14 22:03:43 -0400 |
commit | d5b52a1302ef4409424ec0633ccf9bd72359ea32 (patch) | |
tree | 76d90c6b51f8bf234cc19cce75147d6089a1b808 /src/util.c | |
parent | bfe96a6aa5fa3ca9a05b658efbcaee9dc01b5235 (diff) | |
download | runes-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.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; |