소스 검색

Warn once when external key combo is used and key-handler not installed

master
Bert Münnich 11 년 전
부모
커밋
653a6ee83b
2개의 변경된 파일15개의 추가작업 그리고 5개의 파일을 삭제
  1. +1
    -1
      Makefile
  2. +14
    -4
      main.c

+ 1
- 1
Makefile 파일 보기

@@ -1,4 +1,4 @@
VERSION = git-20140207
VERSION = git-20140218


PREFIX = /usr/local PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man MANPREFIX = $(PREFIX)/share/man


+ 14
- 4
main.c 파일 보기

@@ -86,7 +86,10 @@ struct {
bool open; bool open;
} info; } info;


char * keyhandler;
struct {
char *cmd;
bool warned;
} keyhandler;


timeout_t timeouts[] = { timeout_t timeouts[] = {
{ { 0, 0 }, false, redraw }, { { 0, 0 }, false, redraw },
@@ -453,7 +456,14 @@ void run_key_handler(const char *key, unsigned int mask)
char kstr[32]; char kstr[32];
struct stat oldst, newst; struct stat oldst, newst;


if (keyhandler == NULL || key == NULL)
if (keyhandler.cmd == NULL) {
if (!keyhandler.warned) {
warn("key handler not installed");
keyhandler.warned = true;
}
return;
}
if (key == NULL)
return; return;


snprintf(kstr, sizeof(kstr), "%s%s%s%s", snprintf(kstr, sizeof(kstr), "%s%s%s%s",
@@ -464,7 +474,7 @@ void run_key_handler(const char *key, unsigned int mask)
stat(files[n].path, &oldst); stat(files[n].path, &oldst);


if ((pid = fork()) == 0) { if ((pid = fork()) == 0) {
execl(keyhandler, keyhandler, kstr, files[n].path, NULL);
execl(keyhandler.cmd, keyhandler.cmd, kstr, files[n].path, NULL);
warn("could not exec key handler"); warn("could not exec key handler");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} else if (pid < 0) { } else if (pid < 0) {
@@ -810,7 +820,7 @@ int main(int argc, char **argv)
dsuffix = "/.config"; dsuffix = "/.config";
} }
if (homedir != NULL) { if (homedir != NULL) {
char **cmd[] = { &info.cmd, &keyhandler };
char **cmd[] = { &info.cmd, &keyhandler.cmd };
const char *name[] = { "image-info", "key-handler" }; const char *name[] = { "image-info", "key-handler" };


for (i = 0; i < ARRLEN(cmd); i++) { for (i = 0; i < ARRLEN(cmd); i++) {


불러오는 중...
취소
저장