From b374c35758777f98e5ddbe4b0dc43bd7c80f36d7 Mon Sep 17 00:00:00 2001 From: Zandr Martin Date: Thu, 1 Sep 2016 21:39:08 -0500 Subject: refactor commands.c --- sway/commands/exit.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 sway/commands/exit.c (limited to 'sway/commands/exit.c') diff --git a/sway/commands/exit.c b/sway/commands/exit.c new file mode 100644 index 00000000..fe3212a4 --- /dev/null +++ b/sway/commands/exit.c @@ -0,0 +1,17 @@ +#include "commands.h" +#include "container.h" + +void sway_terminate(int exit_code); + +struct cmd_results *cmd_exit(int argc, char **argv) { + struct cmd_results *error = NULL; + if (config->reading) return cmd_results_new(CMD_FAILURE, "exit", "Can't be used in config file."); + if ((error = checkarg(argc, "exit", EXPECTED_EQUAL_TO, 0))) { + return error; + } + // Close all views + close_views(&root_container); + sway_terminate(EXIT_SUCCESS); + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} + -- cgit v1.2.3 From 65ace5dec5c24695501056376e227fb9b1f84a3a Mon Sep 17 00:00:00 2001 From: Zandr Martin Date: Fri, 2 Sep 2016 14:11:48 -0500 Subject: merge in latest commits --- sway/commands/exit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sway/commands/exit.c') diff --git a/sway/commands/exit.c b/sway/commands/exit.c index fe3212a4..f192f86a 100644 --- a/sway/commands/exit.c +++ b/sway/commands/exit.c @@ -1,5 +1,5 @@ -#include "commands.h" -#include "container.h" +#include "sway/commands.h" +#include "sway/container.h" void sway_terminate(int exit_code); -- cgit v1.2.3