diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-12-02 08:10:03 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2016-12-02 08:10:03 -0500 |
commit | f23880b1fdd70a21b04317c18208a1f3ce356839 (patch) | |
tree | 51a54d43531ac28ef014193abef8f4ccd7a78332 /sway/commands | |
parent | 0d395681feb13e41a1ba7f70a4e100e9094547f4 (diff) |
Add support for command policies in config file
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/commands.c | 23 | ||||
-rw-r--r-- | sway/commands/permit.c | 3 |
2 files changed, 24 insertions, 2 deletions
diff --git a/sway/commands/commands.c b/sway/commands/commands.c new file mode 100644 index 00000000..5d248e30 --- /dev/null +++ b/sway/commands/commands.c @@ -0,0 +1,23 @@ +#include <stdbool.h> +#include <string.h> +#include "sway/commands.h" +#include "sway/config.h" +#include "list.h" +#include "log.h" + +struct cmd_results *cmd_commands(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "commands", EXPECTED_EQUAL_TO, 1))) { + return error; + } + + if (strcmp(argv[0], "{") != 0) { + return cmd_results_new(CMD_FAILURE, "commands", "Expected block declaration"); + } + + if (!config->reading) { + return cmd_results_new(CMD_FAILURE, "commands", "Can only be used in config file."); + } + + return cmd_results_new(CMD_BLOCK_COMMANDS, NULL, NULL); +} diff --git a/sway/commands/permit.c b/sway/commands/permit.c index 8a7bb98c..258ea5b2 100644 --- a/sway/commands/permit.c +++ b/sway/commands/permit.c @@ -20,8 +20,7 @@ static enum secure_feature get_features(int argc, char **argv, { "keyboard", FEATURE_KEYBOARD }, { "mouse", FEATURE_MOUSE }, }; - size_t names_len = sizeof(feature_names) / - (sizeof(char *) + sizeof(enum secure_feature)); + size_t names_len = 7; for (int i = 1; i < argc; ++i) { size_t j; |