mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 16:36:26 +01:00
Fix quote handling for commands
Quotes are now stripped for all arguments and stripped before anything is unescaped
This commit is contained in:
parent
af45ee2d8b
commit
0a0cf4540a
1 changed files with 3 additions and 10 deletions
|
@ -391,14 +391,12 @@ struct cmd_results *config_command(char *exec) {
|
|||
// Var replacement, for all but first argument of set
|
||||
// TODO commands
|
||||
for (i = handler->handle == cmd_set ? 2 : 1; i < argc; ++i) {
|
||||
if (*argv[i] == '\"' || *argv[i] == '\'') {
|
||||
strip_quotes(argv[i]);
|
||||
}
|
||||
argv[i] = do_var_replacement(argv[i]);
|
||||
unescape_string(argv[i]);
|
||||
}
|
||||
// Strip quotes for first argument.
|
||||
// TODO This part needs to be handled much better
|
||||
if (argc>1 && (*argv[1] == '\"' || *argv[1] == '\'')) {
|
||||
strip_quotes(argv[1]);
|
||||
}
|
||||
if (handler->handle) {
|
||||
results = handler->handle(argc-1, argv+1);
|
||||
} else {
|
||||
|
@ -422,11 +420,6 @@ struct cmd_results *config_subcommand(char **argv, int argc,
|
|||
char *input = argv[0] ? argv[0] : "(empty)";
|
||||
return cmd_results_new(CMD_INVALID, input, "Unknown/invalid command");
|
||||
}
|
||||
// Strip quotes for first argument.
|
||||
// TODO This part needs to be handled much better
|
||||
if (argc > 1 && (*argv[1] == '\"' || *argv[1] == '\'')) {
|
||||
strip_quotes(argv[1]);
|
||||
}
|
||||
if (handler->handle) {
|
||||
return handler->handle(argc - 1, argv + 1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue