From eb79ce65c9eacef95887d9a92d820951fb25fc7c Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 6 Jul 2017 17:01:10 +0000 Subject: [PATCH 1/3] from src, by espie@: no need to generate y.tab.h if nothing uses it, set YFLAGS to nothing --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f00441b..24e11d5 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ SRCS= calmwm.c screen.c xmalloc.c client.c menu.c \ CPPFLAGS+= -I${X11BASE}/include -I${X11BASE}/include/freetype2 -I${.CURDIR} CFLAGS+= -Wall - +YFLAGS= LDADD+= -L${X11BASE}/lib -lXft -lXrender -lX11 -lxcb -lXau -lXdmcp \ -lfontconfig -lexpat -lfreetype -lz -lXrandr -lXext From f94fde51fb5c0a0afe44d627ba7493118bfc3d6f Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 6 Jul 2017 17:09:17 +0000 Subject: [PATCH 2/3] fix a few WARNINGS (new sentence, new line and extraneous Pp macro) found with mandoc -Tlint --- cwmrc.5 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cwmrc.5 b/cwmrc.5 index 389083e..a29fd12 100644 --- a/cwmrc.5 +++ b/cwmrc.5 @@ -245,7 +245,6 @@ A special keyword .Dq all can be used to unbind all buttons. -.Pp .El .Sh BIND FUNCTION LIST .Bl -tag -width 23n -compact @@ -325,12 +324,12 @@ Vertically maximize current window (gap + border honored). Horizontally maximize current window (gap + border honored). .It window-htile Current window is placed at the top of the screen, maximized -horizontally and resized to half of the vertical screen space. Other -windows in its group share remaining screen space. +horizontally and resized to half of the vertical screen space. +Other windows in its group share remaining screen space. .It window-vtile Current window is placed on the left of the screen, maximized vertically -and resized to half of the horizontal screen space. Other windows in its -group share remaining screen space. +and resized to half of the horizontal screen space. +Other windows in its group share remaining screen space. .It window-move Move current window. .It window-resize From d179dfdeb97d1f4d16d56ae5783044770d87898c Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 10 Jul 2017 13:36:58 +0000 Subject: [PATCH 3/3] Replace fgetln(3) with POSIX getline(3); inspired by brynet and Ingo. feedback and ok brynet@ --- kbfunc.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/kbfunc.c b/kbfunc.c index f705b9d..c9847f9 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -468,6 +468,7 @@ kbfunc_menu_ssh(void *ctx, struct cargs *cargs) char path[PATH_MAX]; int l; size_t len; + ssize_t slen; TAILQ_FOREACH(cmd, &Conf.cmdq, entry) { if (strcmp(cmd->name, "term") == 0) @@ -481,20 +482,16 @@ kbfunc_menu_ssh(void *ctx, struct cargs *cargs) } lbuf = NULL; - while ((buf = fgetln(fp, &len))) { - if (buf[len - 1] == '\n') - buf[len - 1] = '\0'; - else { - /* EOF without EOL, copy and add the NUL */ - lbuf = xmalloc(len + 1); - (void)memcpy(lbuf, buf, len); - lbuf[len] = '\0'; - buf = lbuf; - } + 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 + len; p++) { + for (p = buf; *p != ',' && *p != ' ' && p != buf + slen; p++) { /* do nothing */ } /* ignore badness */ @@ -504,6 +501,8 @@ kbfunc_menu_ssh(void *ctx, struct cargs *cargs) 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, (CWM_MENU_DUMMY),