mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 01:41:30 +00:00
Merge pull request #465 from sardemff7/master
Some fixes in commands/assign
This commit is contained in:
commit
78b2808c52
|
@ -169,15 +169,18 @@ static struct cmd_results *cmd_assign(int argc, char **argv) {
|
||||||
|
|
||||||
char *criteria = *argv++;
|
char *criteria = *argv++;
|
||||||
|
|
||||||
if (strncmp(*argv, "→", 1) == 0) {
|
if (strncmp(*argv, "→", strlen("→")) == 0) {
|
||||||
|
if (argc < 3) {
|
||||||
|
return cmd_results_new(CMD_INVALID, "assign", "Missing workspace");
|
||||||
|
}
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *movecmd = "move container to workspace ";
|
char *movecmd = "move container to workspace ";
|
||||||
int arglen = strlen(*argv);
|
int arglen = strlen(movecmd) + strlen(*argv) + 1;
|
||||||
char *cmdlist = calloc(1, sizeof(movecmd) + arglen);
|
char *cmdlist = calloc(1, arglen);
|
||||||
|
|
||||||
sprintf(cmdlist, "%s%s", movecmd, *argv);
|
snprintf(cmdlist, arglen, "%s%s", movecmd, *argv);
|
||||||
|
|
||||||
struct criteria *crit = malloc(sizeof(struct criteria));
|
struct criteria *crit = malloc(sizeof(struct criteria));
|
||||||
crit->crit_raw = strdup(criteria);
|
crit->crit_raw = strdup(criteria);
|
||||||
|
|
Loading…
Reference in a new issue