mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
put a default known_hosts into conf
This commit is contained in:
parent
75f65f399e
commit
479e9f769c
1
calmwm.h
1
calmwm.h
@ -298,6 +298,7 @@ struct conf {
|
||||
char *menucolor[CWM_COLOR_MENU_MAX];
|
||||
char termpath[MAXPATHLEN];
|
||||
char lockpath[MAXPATHLEN];
|
||||
char known_hosts[MAXPATHLEN];
|
||||
#define CONF_FONT "sans-serif:pixelsize=14:bold"
|
||||
char *font;
|
||||
};
|
||||
|
3
conf.c
3
conf.c
@ -193,6 +193,9 @@ conf_init(struct conf *c)
|
||||
(void)strlcpy(c->termpath, "xterm", sizeof(c->termpath));
|
||||
(void)strlcpy(c->lockpath, "xlock", sizeof(c->lockpath));
|
||||
|
||||
(void)snprintf(c->known_hosts, sizeof(c->known_hosts), "%s/%s",
|
||||
homedir, ".ssh/known_hosts");
|
||||
|
||||
c->font = xstrdup(CONF_FONT);
|
||||
}
|
||||
|
||||
|
11
kbfunc.c
11
kbfunc.c
@ -33,7 +33,6 @@
|
||||
|
||||
#include "calmwm.h"
|
||||
|
||||
#define KNOWN_HOSTS ".ssh/known_hosts"
|
||||
#define HASH_MARKER "|1|"
|
||||
|
||||
extern char **cwm_argv;
|
||||
@ -325,17 +324,15 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg)
|
||||
struct menu_q menuq;
|
||||
FILE *fp;
|
||||
char *buf, *lbuf, *p;
|
||||
char hostbuf[MAXHOSTNAMELEN], filename[MAXPATHLEN];
|
||||
char hostbuf[MAXHOSTNAMELEN];
|
||||
char cmd[256];
|
||||
int l;
|
||||
size_t len;
|
||||
|
||||
l = snprintf(filename, sizeof(filename), "%s/%s", homedir, KNOWN_HOSTS);
|
||||
if (l == -1 || l >= sizeof(filename))
|
||||
return;
|
||||
|
||||
if ((fp = fopen(filename, "r")) == NULL)
|
||||
if ((fp = fopen(Conf.known_hosts, "r")) == NULL) {
|
||||
warn("kbfunc_ssh: %s", Conf.known_hosts);
|
||||
return;
|
||||
}
|
||||
|
||||
TAILQ_INIT(&menuq);
|
||||
lbuf = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user