aboutsummaryrefslogtreecommitdiffstats
path: root/kbfunc.c
diff options
context:
space:
mode:
authorWynn Wolf Arbor2020-03-18 19:46:52 +0100
committerWolfgang Müller2021-04-27 12:28:35 +0200
commit26a8c6ced076b6a49b130deb4fe35d6707bebbae (patch)
tree171ed0f661c87273c629f413b64513f2e9d4e625 /kbfunc.c
parenta0387a0fd66954e024c926655c866a3ab80e460f (diff)
downloadcwm-26a8c6ced076b6a49b130deb4fe35d6707bebbae.tar.gz
Remove ssh menu
There is no point in keeping this functionality. Saving a few key strokes is not worth the added complexity of the window manager parsing the known_hosts file.
Diffstat (limited to 'kbfunc.c')
-rw-r--r--kbfunc.c66
1 files changed, 0 insertions, 66 deletions
diff --git a/kbfunc.c b/kbfunc.c
index 9e7118a..8af8436 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -684,72 +684,6 @@ out:
}
void
-kbfunc_menu_ssh(void *ctx, struct cargs *cargs)
-{
- struct screen_ctx *sc = ctx;
- struct cmd_ctx *cmd;
- struct menu *mi;
- struct menu_q menuq;
- FILE *fp;
- char *buf, *lbuf, *p;
- char hostbuf[HOST_NAME_MAX+1];
- char path[PATH_MAX];
- int l;
- size_t len;
- ssize_t slen;
- int mflags = (CWM_MENU_DUMMY);
-
- TAILQ_FOREACH(cmd, &Conf.cmdq, entry) {
- if (strcmp(cmd->name, "term") == 0)
- break;
- }
- TAILQ_INIT(&menuq);
-
- if ((fp = fopen(Conf.known_hosts, "r")) == NULL) {
- warn("%s: %s", __func__, Conf.known_hosts);
- goto menu;
- }
-
- lbuf = NULL;
- len = 0;
- while ((slen = getline(&lbuf, &len, fp)) != -1) {
- buf = lbuf;
- if (buf[slen - 1] == '\n')
- buf[slen - 1] = '\0';
-
- /* skip hashed hosts */
- if (strncmp(buf, HASH_MARKER, strlen(HASH_MARKER)) == 0)
- continue;
- for (p = buf; *p != ',' && *p != ' ' && p != buf + slen; p++)
- ;
- /* ignore badness */
- if (p - buf + 1 > sizeof(hostbuf))
- continue;
- (void)strlcpy(hostbuf, buf, p - buf + 1);
- menuq_add(&menuq, NULL, "%s", hostbuf);
- }
- free(lbuf);
- if (ferror(fp))
- err(1, "%s", path);
- (void)fclose(fp);
-menu:
- if ((mi = menu_filter(sc, &menuq, "ssh", NULL, mflags,
- search_match_text, search_print_text)) != NULL) {
- if (mi->text[0] == '\0')
- goto out;
- l = snprintf(path, sizeof(path), "%s -T '[ssh] %s' -e ssh %s",
- cmd->path, mi->text, mi->text);
- if (l == -1 || l >= sizeof(path))
- goto out;
- u_spawn(path);
- }
-out:
- if (mi != NULL && mi->dummy)
- free(mi);
- menuq_clear(&menuq);
-}
-
-void
kbfunc_client_menu_label(void *ctx, struct cargs *cargs)
{
struct client_ctx *cc = ctx;