From 3be11a08e61cfc9e72beab612469466035d320c7 Mon Sep 17 00:00:00 2001 From: "S. Christoffer Eliesen" Date: Sun, 18 Oct 2015 19:53:56 +0200 Subject: [PATCH] main: Implement --get-socketpath switch. --- include/ipc.h | 1 + sway/main.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/ipc.h b/include/ipc.h index 2d71c666..1932ad2d 100644 --- a/include/ipc.h +++ b/include/ipc.h @@ -14,5 +14,6 @@ enum ipc_command_type { void ipc_init(void); void ipc_terminate(void); +struct sockaddr_un *ipc_user_sockaddr(void); #endif diff --git a/sway/main.c b/sway/main.c index de17f440..a4fe5823 100644 --- a/sway/main.c +++ b/sway/main.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include "layout.h" @@ -105,8 +106,11 @@ int main(int argc, char **argv) { case 'V': // verbose verbose = 1; break; - case 'p': // --get-socketpath - // TODO + case 'p': ; // --get-socketpath + struct sockaddr_un *ipc_sockaddr = ipc_user_sockaddr(); + fprintf(stdout, "%s\n", ipc_sockaddr->sun_path); + free(ipc_sockaddr); + exit(0); break; } }