From d7d21bb0f895248cafefc3d12e4aed033a8e5d17 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 22 Nov 2017 21:20:41 -0500 Subject: Add initial command subsystem (untested) Need to spin up the IPC server to test this --- sway/commands/exit.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 sway/commands/exit.c (limited to 'sway/commands') diff --git a/sway/commands/exit.c b/sway/commands/exit.c new file mode 100644 index 00000000..d294e344 --- /dev/null +++ b/sway/commands/exit.c @@ -0,0 +1,19 @@ +#include +#include "sway/commands.h" + +void sway_terminate(int exit_code); + +struct cmd_results *cmd_exit(int argc, char **argv) { + struct cmd_results *error = NULL; + /* TODO + 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; + } + sway_terminate(0); + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} + -- cgit v1.2.3