diff options
author | Ian Fan <[email protected]> | 2018-12-09 12:09:11 +0000 |
---|---|---|
committer | Ian Fan <[email protected]> | 2019-01-01 09:01:25 +0000 |
commit | a82b8a3c14e45697708e57f8cb27a8fc6cf31839 (patch) | |
tree | 5e30327566fb6f30bd6d319f7b8a96226683e986 /common/ipc-client.c | |
parent | 967566e37f93890bd5255725129c929aeeac709e (diff) |
Remove readline.c
All occurrences of read_line have been replaced by getline.
peek_line has been absorbed into detect_brace.
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; } |