mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
re-introduce the intention of the change from rev 1.4 in menu.c here
instead, by moving the check for '\0' to only the places that it matters. hint and 50% of the diff from oga@, prodded by todd@ ok oga@
This commit is contained in:
parent
38ad2e1d9c
commit
4af6a60d84
8
kbfunc.c
8
kbfunc.c
@ -285,6 +285,8 @@ kbfunc_exec(struct client_ctx *scratch, union arg *arg)
|
|||||||
|
|
||||||
if ((mi = menu_filter(&menuq, label, NULL, 1,
|
if ((mi = menu_filter(&menuq, label, NULL, 1,
|
||||||
search_match_exec, NULL)) != NULL) {
|
search_match_exec, NULL)) != NULL) {
|
||||||
|
if (mi->text[0] == '\0')
|
||||||
|
goto out;
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case CWM_EXEC_PROGRAM:
|
case CWM_EXEC_PROGRAM:
|
||||||
u_spawn(mi->text);
|
u_spawn(mi->text);
|
||||||
@ -298,7 +300,7 @@ kbfunc_exec(struct client_ctx *scratch, union arg *arg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
out:
|
||||||
if (mi != NULL && mi->dummy)
|
if (mi != NULL && mi->dummy)
|
||||||
xfree(mi);
|
xfree(mi);
|
||||||
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
||||||
@ -360,12 +362,14 @@ kbfunc_ssh(struct client_ctx *scratch, union arg *arg)
|
|||||||
|
|
||||||
if ((mi = menu_filter(&menuq, "ssh", NULL, 1,
|
if ((mi = menu_filter(&menuq, "ssh", NULL, 1,
|
||||||
search_match_exec, NULL)) != NULL) {
|
search_match_exec, NULL)) != NULL) {
|
||||||
|
if (mi->text[0] == '\0')
|
||||||
|
goto out;
|
||||||
l = snprintf(cmd, sizeof(cmd), "%s -e ssh %s", Conf.termpath,
|
l = snprintf(cmd, sizeof(cmd), "%s -e ssh %s", Conf.termpath,
|
||||||
mi->text);
|
mi->text);
|
||||||
if (l != -1 && l < sizeof(cmd))
|
if (l != -1 && l < sizeof(cmd))
|
||||||
u_spawn(cmd);
|
u_spawn(cmd);
|
||||||
}
|
}
|
||||||
|
out:
|
||||||
if (mi != NULL && mi->dummy)
|
if (mi != NULL && mi->dummy)
|
||||||
xfree(mi);
|
xfree(mi);
|
||||||
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user