commit 83c23f274c89e31473fd13b93f287e1c7516a040
parent ee9b9414b9356593be835c16c68bfc73aad63425
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 18 Oct 2015 14:25:57 -0400
Merge pull request #195 from sce/get_socketpath
main: Implement --get-socketpath switch.
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git 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
@@ -4,6 +4,7 @@
#include <wlc/wlc.h>
#include <sys/wait.h>
#include <sys/types.h>
+#include <sys/un.h>
#include <signal.h>
#include <getopt.h>
#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;
}
}