ok
On 22/01 15:15, Okan Demirmen wrote:
> Hi,
>
> I think we've (or at least I have) mused about this for a while; a
> recent mail reminded me that this feature should go - a window manager
> doesn't need to parse the ssh known_hosts file for a menu; there are
> better tools for this.
>
> Remove menu-ssh.
>
> okay?
>
> Index: calmwm.h
> ===================================================================
> RCS file: /home/open/cvs/xenocara/app/cwm/calmwm.h,v
> retrieving revision 1.372
> diff -u -p -r1.372 calmwm.h
> --- calmwm.h 22 Jan 2020 19:58:35 -0000 1.372
> +++ calmwm.h 22 Jan 2020 20:09:13 -0000
> @@ -304,7 +304,6 @@ struct conf {
> int xrandr;
> int xrandr_event_base;
> char *conf_file;
> - char *known_hosts;
> char *wm_argv;
> int debug;
> };
> @@ -517,7 +516,6 @@ void kbfunc_menu_cmd(void *, struct
> c
> void kbfunc_menu_group(void *, struct cargs *);
> void kbfunc_menu_wm(void *, struct cargs *);
> void kbfunc_menu_exec(void *, struct cargs *);
> -void kbfunc_menu_ssh(void *, struct cargs *);
> void kbfunc_client_menu_label(void *, struct cargs *);
> void kbfunc_exec_cmd(void *, struct cargs *);
> void kbfunc_exec_lock(void *, struct cargs *);
> Index: conf.c
> ===================================================================
> RCS file: /home/open/cvs/xenocara/app/cwm/conf.c,v
> retrieving revision 1.249
> diff -u -p -r1.249 conf.c
> --- conf.c 7 Mar 2019 12:54:21 -0000 1.249
> +++ conf.c 22 Jan 2020 20:09:24 -0000
> @@ -179,7 +179,6 @@ static const struct {
>
> { FUNC_SC(menu-cmd, menu_cmd, 0) },
> { FUNC_SC(menu-group, menu_group, 0) },
> - { FUNC_SC(menu-ssh, menu_ssh, 0) },
> { FUNC_SC(menu-window, menu_client, CWM_MENU_WINDOW_ALL) },
> { FUNC_SC(menu-window-hidden, menu_client, CWM_MENU_WINDOW_HIDDEN) },
> { FUNC_SC(menu-exec, menu_exec, 0) },
> @@ -210,7 +209,6 @@ static const struct {
> { "CM-Delete", "lock" },
> { "M-question", "menu-exec" },
> { "CM-w", "menu-exec-wm" },
> - { "M-period", "menu-ssh" },
> { "M-Return", "window-hide" },
> { "M-Down", "window-lower" },
> { "M-Up", "window-raise" },
> @@ -316,7 +314,6 @@ conf_init(struct conf *c)
> home = "/";
> }
> xasprintf(&c->conf_file, "%s/%s", home, ".cwmrc");
> - xasprintf(&c->known_hosts, "%s/%s", home, ".ssh/known_hosts");
> }
>
> void
> @@ -363,7 +360,6 @@ conf_clear(struct conf *c)
> free(c->color[i]);
>
> free(c->conf_file);
> - free(c->known_hosts);
> free(c->font);
> free(c->wmname);
> }
> Index: cwm.1
> ===================================================================
> RCS file: /home/open/cvs/xenocara/app/cwm/cwm.1,v
> retrieving revision 1.65
> diff -u -p -r1.65 cwm.1
> --- cwm.1 9 Jul 2019 21:38:44 -0000 1.65
> +++ cwm.1 22 Jan 2020 20:08:19 -0000
> @@ -140,15 +140,6 @@ Resize window by a large amount; see
> Spawn
> .Dq exec program
> dialog.
> -.It Ic M-period
> -Spawn
> -.Dq ssh to
> -dialog.
> -This parses
> -.Pa $HOME/.ssh/known_hosts
> -to provide host auto-completion.
> -.Xr ssh 1
> -will be executed via the configured terminal emulator.
> .It Ic CM-w
> Spawn
> .Dq exec WindowManager
> Index: cwmrc.5
> ===================================================================
> RCS file: /home/open/cvs/xenocara/app/cwm/cwmrc.5,v
> retrieving revision 1.73
> diff -u -p -r1.73 cwmrc.5
> --- cwmrc.5 2 Jul 2019 23:37:47 -0000 1.73
> +++ cwmrc.5 22 Jan 2020 20:07:57 -0000
> @@ -280,10 +280,6 @@ menu.
> Launch
> .Dq exec WindowManager
> menu.
> -.It menu-ssh
> -Launch
> -.Dq ssh
> -menu.
> .It group-toggle-[n]
> Toggle visibility of group n, where n is 1-9.
> .It group-only-[n]
> Index: kbfunc.c
> ===================================================================
> RCS file: /home/open/cvs/xenocara/app/cwm/kbfunc.c,v
> retrieving revision 1.167
> diff -u -p -r1.167 kbfunc.c
> --- kbfunc.c 21 Jan 2020 15:50:03 -0000 1.167
> +++ kbfunc.c 22 Jan 2020 20:09:03 -0000
> @@ -647,72 +647,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;
>