diff options
author | emersion <[email protected]> | 2019-01-08 10:05:37 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-01-08 10:05:37 +0100 |
commit | 140bc2dd5b81205df58bf06e695788e689fae397 (patch) | |
tree | 6a88913630734736763b12ec0b10da68ef413256 /common/ipc-client.c | |
parent | 353d9ed74f3560e12500c08920cf8a1ca3344cc2 (diff) | |
parent | 5bef06adfdac4ce9940dcaf2d90a4bdffae7bba9 (diff) |
Merge pull request #3275 from ianyfan/remove-readline
Rewrite strip_whitespace and remove readline.c
Diffstat (limited to 'common/ipc-client.c')
-rw-r--r-- | common/ipc-client.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/common/ipc-client.c b/common/ipc-client.c index 496fd131..3515ef0a 100644 --- a/common/ipc-client.c +++ b/common/ipc-client.c @@ -7,7 +7,6 @@ #include <sys/un.h> #include <unistd.h> #include "ipc-client.h" -#include "readline.h" #include "log.h" static const char ipc_magic[] = {'i', '3', '-', 'i', 'p', 'c'}; @@ -18,28 +17,30 @@ char *get_socketpath(void) { if (swaysock) { return strdup(swaysock); } + char *line = NULL; + size_t line_size = 0; FILE *fp = popen("sway --get-socketpath 2>/dev/null", "r"); if (fp) { - char *line = read_line(fp); + getline(&line, &line_size, fp); pclose(fp); if (line && *line) { return line; } - free(line); } const char *i3sock = getenv("I3SOCK"); if (i3sock) { + free(line); return strdup(i3sock); } fp = popen("i3 --get-socketpath 2>/dev/null", "r"); if (fp) { - char *line = read_line(fp); + getline(&line, &line_size, fp); pclose(fp); if (line && *line) { return line; } - free(line); } + free(line); return NULL; } |