~mcf/oasis

b5ab88f9048f369722d373e2f383e3096d26bc27 — Michael Forney 5 months ago 10f937d
catgirl: Update to 2.1
M pkg/catgirl/gen.lua => pkg/catgirl/gen.lua +2 -0
@@ 20,10 20,12 @@ exe('catgirl', [[
	edit.c
	filter.c
	handle.c
	input.c
	irc.c
	log.c
	ui.c
	url.c
	window.c
	xdg.c
	$builddir/pkg/libtls-bearssl/libtls.a.d
	$builddir/pkg/netbsd-curses/libcurses.a.d

M pkg/catgirl/patch/0001-Revert-Use-gnu-case-range-and-gnu-conditional-omitte.patch => pkg/catgirl/patch/0001-Revert-Use-gnu-case-range-and-gnu-conditional-omitte.patch +67 -48
@@ 1,4 1,4 @@
From 48ce2b38033ae93717fd330c3cb6c0476e2979e5 Mon Sep 17 00:00:00 2001
From beac90889183cb71ca3dfc8c9ada9175879b9c34 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Thu, 7 May 2020 00:36:14 -0700
Subject: [PATCH] Revert "Use gnu-case-range and


@@ 6,30 6,32 @@ Subject: [PATCH] Revert "Use gnu-case-range and

This reverts commit 75a6aa9258270169f43f56e063f1bfb57eebe56b.
---
 Makefile   |  3 +--
 Makefile   |  2 --
 command.c  | 33 +++++++++++++++++++--------------
 complete.c |  4 ++--
 edit.c     |  2 +-
 handle.c   | 45 +++++++++++++++++++++++++++------------------
 ui.c       |  9 +++++++--
 input.c    |  7 ++++++-
 url.c      |  2 +-
 6 files changed, 57 insertions(+), 39 deletions(-)
 window.c   |  2 +-
 8 files changed, 57 insertions(+), 40 deletions(-)

diff --git a/Makefile b/Makefile
index 48fc350..ac452d2 100644
index 3abba03..9518cda 100644
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,7 @@ PREFIX ?= /usr/local
@@ -2,9 +2,7 @@ PREFIX ?= /usr/local
 BINDIR ?= ${PREFIX}/bin
 MANDIR ?= ${PREFIX}/man
 
-CEXTS = gnu-case-range gnu-conditional-omitted-operand
-CFLAGS += -std=c11 -Wall -Wextra -Wpedantic ${CEXTS:%=-Wno-%}
+CFLAGS += -std=c11 -Wall -Wextra -Wpedantic
 CFLAGS += -std=c11 -Wall -Wextra -Wpedantic -Wmissing-prototypes
-CFLAGS += ${CEXTS:%=-Wno-%}
 LDADD.libtls = -ltls
 LDADD.ncursesw = -lncursesw
 
diff --git a/command.c b/command.c
index 335c396..d87e162 100644
index a127af3..f5be51b 100644
--- a/command.c
+++ b/command.c
@@ -68,8 +68,8 @@ static int splitChunk(const char *cmd, uint id) {


@@ 161,11 163,24 @@ index 9e59db5..9ea1192 100644
 	return node;
 }
 
diff --git a/edit.c b/edit.c
index bb92edf..07705dd 100644
--- a/edit.c
+++ b/edit.c
@@ -69,7 +69,7 @@ int editReserve(struct Edit *e, size_t index, size_t count) {
 		return -1;
 	}
 	if (e->len + count > e->cap) {
-		size_t cap = (e->cap ?: 256);
+		size_t cap = (e->cap ? e->cap : 256);
 		while (cap < e->len + count) cap *= 2;
 		wchar_t *buf = realloc(e->buf, sizeof(*buf) * cap);
 		if (!buf) return -1;
diff --git a/handle.c b/handle.c
index e460c7c..0cdda74 100644
index 9f051c7..a4f1015 100644
--- a/handle.c
+++ b/handle.c
@@ -299,9 +299,9 @@ static void handleReplyISupport(struct Message *msg) {
@@ -301,9 +301,9 @@ static void handleReplyISupport(struct Message *msg) {
 			set(&network.setParamModes, setParam);
 			set(&network.channelModes, channel);
 		} else if (!strcmp(key, "EXCEPTS")) {


@@ 177,7 192,7 @@ index e460c7c..0cdda74 100644
 		}
 	}
 }
@@ -354,7 +354,7 @@ static void handleJoin(struct Message *msg) {
@@ -356,7 +356,7 @@ static void handleJoin(struct Message *msg) {
 		"\3%02d%s\3\t%s%s%sarrives in \3%02d%s\3",
 		hash(msg->user), msg->nick,
 		(msg->params[2] ? "(" : ""),


@@ 186,7 201,7 @@ index e460c7c..0cdda74 100644
 		(msg->params[2] ? "\17) " : ""),
 		hash(msg->params[0]), msg->params[0]
 	);
@@ -386,12 +386,14 @@ static void handlePart(struct Message *msg) {
@@ -388,12 +388,14 @@ static void handlePart(struct Message *msg) {
 		id, heat, tagTime(msg),
 		"\3%02d%s\3\tleaves \3%02d%s\3%s%s",
 		hash(msg->user), msg->nick, hash(msg->params[0]), msg->params[0],


@@ 203,7 218,7 @@ index e460c7c..0cdda74 100644
 	);
 }
 
@@ -408,12 +410,14 @@ static void handleKick(struct Message *msg) {
@@ -410,12 +412,14 @@ static void handleKick(struct Message *msg) {
 		hash(msg->user), msg->nick,
 		completeColor(id, msg->params[1]), msg->params[1],
 		hash(msg->params[0]), msg->params[0],


@@ 220,7 235,7 @@ index e460c7c..0cdda74 100644
 	);
 	completeRemove(id, msg->params[1]);
 	if (kicked) completeClear(id);
@@ -464,13 +468,15 @@ static void handleQuit(struct Message *msg) {
@@ -466,13 +470,15 @@ static void handleQuit(struct Message *msg) {
 			id, heat, tagTime(msg),
 			"\3%02d%s\3\tleaves%s%s",
 			hash(msg->user), msg->nick,


@@ 238,7 253,7 @@ index e460c7c..0cdda74 100644
 		);
 	}
 	completeRemove(None, msg->nick);
@@ -732,7 +738,7 @@ static void handleReplyUserModeIs(struct Message *msg) {
@@ -734,7 +740,7 @@ static void handleReplyUserModeIs(struct Message *msg) {
 		if (*ch == '+') continue;
 		const char *name = UserModes[(byte)*ch];
 		ptr = seprintf(


@@ 247,7 262,7 @@ index e460c7c..0cdda74 100644
 		);
 	}
 	uiFormat(
@@ -772,13 +778,13 @@ static void handleReplyChannelModeIs(struct Message *msg) {
@@ -774,13 +780,13 @@ static void handleReplyChannelModeIs(struct Message *msg) {
 			assert(param < ParamCap);
 			ptr = seprintf(
 				ptr, end, ", +%c%s%s %s",


@@ 263,7 278,7 @@ index e460c7c..0cdda74 100644
 			);
 		}
 	}
@@ -805,7 +811,7 @@ static void handleMode(struct Message *msg) {
@@ -807,7 +813,7 @@ static void handleMode(struct Message *msg) {
 				hash(msg->user), msg->nick,
 				(set ? "" : "un"),
 				self.color, msg->params[0],


@@ 272,7 287,7 @@ index e460c7c..0cdda74 100644
 			);
 		}
 		return;
@@ -962,7 +968,7 @@ static void handleErrorBanListFull(struct Message *msg) {
@@ -964,7 +970,7 @@ static void handleErrorBanListFull(struct Message *msg) {
 	require(msg, false, 4);
 	uiFormat(
 		idFor(msg->params[1]), Warm, tagTime(msg),


@@ 281,7 296,7 @@ index e460c7c..0cdda74 100644
 	);
 }
 
@@ -1067,14 +1073,15 @@ static void handleReplyWhoisIdle(struct Message *msg) {
@@ -1069,14 +1075,15 @@ static void handleReplyWhoisIdle(struct Message *msg) {
 		}
 	}
 	char signon[sizeof("0000-00-00 00:00:00")];


@@ 299,7 314,7 @@ index e460c7c..0cdda74 100644
 	);
 }
 
@@ -1109,7 +1116,9 @@ static void handleReplyWhoisGeneric(struct Message *msg) {
@@ -1111,7 +1118,9 @@ static void handleReplyWhoisGeneric(struct Message *msg) {
 		Network, Warm, tagTime(msg),
 		"\3%02d%s\3\t%s%s%s",
 		completeColor(Network, msg->params[1]), msg->params[1],


@@ 310,7 325,7 @@ index e460c7c..0cdda74 100644
 	);
 }
 
@@ -1184,7 +1193,7 @@ static bool isMention(const struct Message *msg) {
@@ -1186,7 +1195,7 @@ static bool isMention(const struct Message *msg) {
 	const char *match = msg->params[1];
 	while (NULL != (match = strstr(match, self.nick))) {
 		char a = (match > msg->params[1] ? match[-1] : ' ');


@@ 319,40 334,31 @@ index e460c7c..0cdda74 100644
 		if ((isspace(a) || ispunct(a)) && (isspace(b) || ispunct(b))) {
 			return true;
 		}
diff --git a/ui.c b/ui.c
index 2789bd7..4b87a1f 100644
--- a/ui.c
+++ b/ui.c
@@ -497,7 +497,7 @@ static size_t windowTop(const struct Window *window) {
 }
 
 static size_t windowBottom(const struct Window *window) {
-	size_t bottom = BufferCap - (window->scroll ?: 1);
+	size_t bottom = BufferCap - (window->scroll ? window->scroll : 1);
 	if (window->scroll) bottom -= SplitLines + MarkerLines;
 	return bottom;
 }
@@ -976,7 +976,6 @@ static void keyCode(int code) {
 		break; case KeyMetaGt: scrollTo(window, 0);
 		break; case KeyMetaLt: scrollTop(window);
diff --git a/input.c b/input.c
index f3813c4..820bf3c 100644
--- a/input.c
+++ b/input.c
@@ -417,7 +417,6 @@ static void keyCode(int code) {
 		break; case KeyMetaGt: windowScroll(ScrollAll, -1);
 		break; case KeyMetaLt: windowScroll(ScrollAll, +1);
 
-		break; case KeyMeta0 ... KeyMeta9: uiShowNum(code - KeyMeta0);
 		break; case KeyMetaA: showAuto();
 		break; case KeyMetaB: edit(id, EditPrevWord, 0);
 		break; case KeyMetaD: edit(id, EditDeleteNextWord, 0);
@@ -1006,6 +1005,12 @@ static void keyCode(int code) {
 		break; case KEY_SEND: scrollTo(window, 0);
 		break; case KEY_SHOME: scrollTo(window, BufferCap);
 		break; case KEY_UP: windowScroll(window, +1);
-		break; case KeyMeta0 ... KeyMeta9: windowShow(code - KeyMeta0);
 		break; case KeyMetaA: windowAuto();
 		break; case KeyMetaB: error = editFn(edit, EditPrevWord);
 		break; case KeyMetaD: error = editFn(edit, EditDeleteNextWord);
@@ -448,6 +447,12 @@ static void keyCode(int code) {
 		break; case KEY_SEND: windowScroll(ScrollAll, -1);
 		break; case KEY_SHOME: windowScroll(ScrollAll, +1);
 		break; case KEY_UP: windowScroll(ScrollOne, +1);
+
+		break; default: {
+			if (code >= KeyMeta0 && code <= KeyMeta9) {
+				uiShowNum(code - KeyMeta0);
+				windowShow(code - KeyMeta0);
+			}
+		}
 	}
 	if (error) err(EX_OSERR, "editFn");
 }
 
diff --git a/url.c b/url.c
index 219a83c..9c721e0 100644
--- a/url.c


@@ 366,6 372,19 @@ index 219a83c..9c721e0 100644
 			|| writeString(file, url->url);
 		if (error) return error;
 	}
diff --git a/window.c b/window.c
index ee0911f..d7bc472 100644
--- a/window.c
+++ b/window.c
@@ -220,7 +220,7 @@ static size_t windowTop(const struct Window *window) {
 }
 
 static size_t windowBottom(const struct Window *window) {
-	size_t bottom = BufferCap - (window->scroll ?: 1);
+	size_t bottom = BufferCap - (window->scroll ? window->scroll : 1);
 	if (window->scroll) bottom -= SplitLines + MarkerLines;
 	return bottom;
 }
-- 
2.34.1


M pkg/catgirl/patch/0002-Break-out-of-input-loop-when-UI-is-hidden.patch => pkg/catgirl/patch/0002-Break-out-of-input-loop-when-UI-is-hidden.patch +12 -12
@@ 1,4 1,4 @@
From 923a6d5c2d391af83c8b108c3cf59d5e709e25b0 Mon Sep 17 00:00:00 2001
From 535cd53babbd4d827c7330e223c5e17b1f5128c3 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Mon, 31 May 2021 16:37:09 -0700
Subject: [PATCH] Break out of input loop when UI is hidden


@@ 6,22 6,22 @@ Subject: [PATCH] Break out of input loop when UI is hidden
Otherwise, wget_wch() is called immediately after hiding the UI
with M-l, which restores curses mode when using NetBSD's libcurses.
---
 ui.c | 2 +-
 input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui.c b/ui.c
index 4b87a1f..c92c0df 100644
--- a/ui.c
+++ b/ui.c
@@ -1089,7 +1089,7 @@ void uiRead(void) {
diff --git a/input.c b/input.c
index 820bf3c..f396fbd 100644
--- a/input.c
+++ b/input.c
@@ -543,7 +543,7 @@ void inputRead(void) {
 
 	wint_t ch;
 	static bool paste, style, literal;
-	for (int ret; ERR != (ret = wget_wch(input, &ch));) {
+	for (int ret; !hidden && ERR != (ret = wget_wch(input, &ch));) {
 		if (ret == KEY_CODE_YES && ch == KeyPasteOn) {
 			paste = true;
 		} else if (ret == KEY_CODE_YES && ch == KeyPasteOff) {
-	for (int ret; ERR != (ret = wget_wch(uiInput, &ch));) {
+	for (int ret; !waiting && ERR != (ret = wget_wch(uiInput, &ch));) {
 		bool tabbing = false;
 		size_t pos = edits[tab.id].pos;
 		bool spr = uiSpoilerReveal;
-- 
2.34.1


M pkg/catgirl/patch/0003-Resize-status-window-explicitly-during-resize.patch => pkg/catgirl/patch/0003-Resize-status-window-explicitly-during-resize.patch +9 -9
@@ 1,4 1,4 @@
From 56114f444867f3c13c7de1abbab87818007bba21 Mon Sep 17 00:00:00 2001
From dd47da4db71e820aed9a0cd29d7855903216de65 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Mon, 31 May 2021 16:40:28 -0700
Subject: [PATCH] Resize status window explicitly during resize()


@@ 11,17 11,17 @@ status window explicitly.
 1 file changed, 1 insertion(+)

diff --git a/ui.c b/ui.c
index c92c0df..1e9e03f 100644
index 64bd6ce..4d0012c 100644
--- a/ui.c
+++ b/ui.c
@@ -657,6 +657,7 @@ static void windowReflow(struct Window *window) {
@@ -274,6 +274,7 @@ void uiFormat(
 
 static void resize(void) {
 	wclear(main);
+	wresize(status, 1, COLS);
 	wresize(main, MAIN_LINES, COLS);
 	for (uint num = 0; num < windows.len; ++num) {
 		windowReflow(windows.ptrs[num]);
 void uiResize(void) {
 	wclear(uiMain);
+	wresize(uiStatus, 1, COLS);
 	wresize(uiMain, MAIN_LINES, COLS);
 	windowResize();
 }
-- 
2.34.1


M pkg/catgirl/patch/0004-HACK-Disable-colorized-output-in-M-l-window-list.patch => pkg/catgirl/patch/0004-HACK-Disable-colorized-output-in-M-l-window-list.patch +12 -12
@@ 1,4 1,4 @@
From 9c8a70c58b3b95dcccf3e91f570781938d517dcd Mon Sep 17 00:00:00 2001
From 2c3519fb68301db5a2aef8715b3cd6ea29fa45ae Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Thu, 3 Jun 2021 00:54:30 -0700
Subject: [PATCH] [HACK] Disable colorized output in M-l window list


@@ 6,26 6,26 @@ Subject: [PATCH] [HACK] Disable colorized output in M-l window list
vid_attr is not supported by NetBSD's libcurses, and this is not
crucial feature.
---
 ui.c | 2 --
 window.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/ui.c b/ui.c
index 1e9e03f..dcdf6ae 100644
--- a/ui.c
+++ b/ui.c
@@ -684,7 +684,6 @@ static void windowList(const struct Window *window) {
 
diff --git a/window.c b/window.c
index d7bc472..b322c55 100644
--- a/window.c
+++ b/window.c
@@ -294,7 +294,6 @@ void windowBare(void) {
 		char buf[TimeCap];
 		strftime(buf, sizeof(buf), uiTime.format, localtime(&line->time));
-		vid_attr(colorAttr(Colors[Gray]), colorPair(Colors[Gray], -1), NULL);
 		struct Style style = { .fg = Gray, .bg = Default };
 		strftime(buf, sizeof(buf), windowTime.format, localtime(&line->time));
-		vid_attr(uiAttr(style), uiPair(style), NULL);
 		printf("%s ", buf);
 
 		bool align = false;
@@ -700,7 +699,6 @@ static void windowList(const struct Window *window) {
@@ -310,7 +309,6 @@ void windowBare(void) {
 			size_t tab = strcspn(str, "\t");
 			if (tab < len) len = tab;
 
-			vid_attr(styleAttr(style), stylePair(style), NULL);
-			vid_attr(uiAttr(style), uiPair(style), NULL);
 			printf("%.*s", (int)len, str);
 			str += len;
 		}

A pkg/catgirl/patch/0005-Don-t-rely-on-internal-struct-tags-of-curses-impleme.patch => pkg/catgirl/patch/0005-Don-t-rely-on-internal-struct-tags-of-curses-impleme.patch +37 -0
@@ 0,0 1,37 @@
From 28e65915e9bb137266d8af78233f9e04c9c30130 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Sun, 13 Mar 2022 15:17:58 -0700
Subject: [PATCH] Don't rely on internal struct tags of curses implementation

---
 chat.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/chat.h b/chat.h
index 1c46f00..f65f2f0 100644
--- a/chat.h
+++ b/chat.h
@@ -27,6 +27,7 @@
 
 #include <assert.h>
 #include <ctype.h>
+#include <curses.h>
 #include <err.h>
 #include <getopt.h>
 #include <stdarg.h>
@@ -309,9 +310,9 @@ enum {
 	InputCols = 1024,
 };
 extern char uiTitle[TitleCap];
-extern struct _win_st *uiStatus;
-extern struct _win_st *uiMain;
-extern struct _win_st *uiInput;
+extern WINDOW *uiStatus;
+extern WINDOW *uiMain;
+extern WINDOW *uiInput;
 extern bool uiSpoilerReveal;
 extern struct Util uiNotifyUtil;
 void uiInit(void);
-- 
2.34.1


M pkg/catgirl/src => pkg/catgirl/src +1 -1
@@ 1,1 1,1 @@
Subproject commit 605f889ab57c3465523104812fbf3edeb1e513d9
Subproject commit f51e7b4d2cc601bef8f22d5061ff8fafb012d671

M pkg/catgirl/ver => pkg/catgirl/ver +1 -1
@@ 1,1 1,1 @@
2.0a r0
2.1 r0