mirror of
https://github.com/swaywm/sway.git
synced 2026-03-31 07:11:24 -04:00
refactor commands.c
This commit is contained in:
parent
050704ab23
commit
b374c35758
77 changed files with 3567 additions and 3217 deletions
17
sway/commands/exit.c
Normal file
17
sway/commands/exit.c
Normal file
|
|
@ -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);
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue