catgirl: Update to 1.9a

This commit is contained in:
Michael Forney
2021-08-31 19:02:38 -07:00
parent a3031ffb34
commit ebf52ceed8
7 changed files with 66 additions and 127 deletions
@@ -1,4 +1,4 @@
From 8be1eb6a19a8f467abadc6e9501c18db68b76863 Mon Sep 17 00:00:00 2001
From 2ee883206837a7dc5a0049841b5a9cdc096f67f6 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
@@ -7,15 +7,15 @@ Subject: [PATCH] Revert "Use gnu-case-range and
This reverts commit 75a6aa9258270169f43f56e063f1bfb57eebe56b.
---
Makefile | 3 +--
command.c | 34 +++++++++++++++++++---------------
command.c | 33 +++++++++++++++++++--------------
complete.c | 4 ++--
handle.c | 45 +++++++++++++++++++++++++++------------------
ui.c | 9 +++++++--
url.c | 2 +-
6 files changed, 57 insertions(+), 40 deletions(-)
6 files changed, 57 insertions(+), 39 deletions(-)
diff --git a/Makefile b/Makefile
index b285e8c..7d6e43d 100644
index 373e7d5..a07ef19 100644
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,7 @@ PREFIX ?= /usr/local
@@ -29,7 +29,7 @@ index b285e8c..7d6e43d 100644
LDADD.ncursesw = -lncursesw
diff --git a/command.c b/command.c
index 4c290fc..e566a13 100644
index 5c97ef5..0e90715 100644
--- a/command.c
+++ b/command.c
@@ -68,8 +68,8 @@ static int splitChunk(const char *cmd, uint id) {
@@ -43,7 +43,7 @@ index 4c290fc..e566a13 100644
cmd, idNames[id]
);
assert(overhead > 0 && overhead < 512);
@@ -170,7 +170,7 @@ static void commandPart(uint id, char *params) {
@@ -171,7 +171,7 @@ static void commandPart(uint id, char *params) {
static void commandQuit(uint id, char *params) {
(void)id;
@@ -52,7 +52,7 @@ index 4c290fc..e566a13 100644
}
static void commandNick(uint id, char *params) {
@@ -268,7 +268,7 @@ static void commandOp(uint id, char *params) {
@@ -269,7 +269,7 @@ static void commandOp(uint id, char *params) {
}
static void commandDeop(uint id, char *params) {
@@ -61,7 +61,7 @@ index 4c290fc..e566a13 100644
}
static void commandVoice(uint id, char *params) {
@@ -280,7 +280,7 @@ static void commandVoice(uint id, char *params) {
@@ -281,7 +281,7 @@ static void commandVoice(uint id, char *params) {
}
static void commandDevoice(uint id, char *params) {
@@ -70,22 +70,22 @@ index 4c290fc..e566a13 100644
}
static void commandBan(uint id, char *params) {
@@ -355,12 +355,12 @@ static void commandWhowas(uint id, char *params) {
@@ -356,12 +356,12 @@ static void commandWhowas(uint id, char *params) {
static void commandNS(uint id, char *params) {
(void)id;
- ircFormat("PRIVMSG NickServ :%s\r\n", (params ?: "HELP"));
+ ircFormat("PRIVMSG NickServ :%s\r\n", (params ? params : "HELP"));
- ircFormat("NS %s\r\n", (params ?: "HELP"));
+ ircFormat("NS %s\r\n", (params ? params : "HELP"));
}
static void commandCS(uint id, char *params) {
(void)id;
- ircFormat("PRIVMSG ChanServ :%s\r\n", (params ?: "HELP"));
+ ircFormat("PRIVMSG ChanServ :%s\r\n", (params ? params : "HELP"));
- ircFormat("CS %s\r\n", (params ?: "HELP"));
+ ircFormat("CS %s\r\n", (params ? params : "HELP"));
}
static void commandQuery(uint id, char *params) {
@@ -425,7 +425,8 @@ static void commandFilter(enum Heat heat, uint id, char *params) {
@@ -436,7 +436,8 @@ static void commandFilter(enum Heat heat, uint id, char *params) {
uiFormat(
id, Cold, NULL, "%sing \3%02d%s %s %s %s",
(heat == Hot ? "Highlight" : "Ignor"), Brown, filter.mask,
@@ -95,7 +95,7 @@ index 4c290fc..e566a13 100644
);
} else {
for (size_t i = 0; i < FilterCap && filters[i].mask; ++i) {
@@ -433,8 +434,9 @@ static void commandFilter(enum Heat heat, uint id, char *params) {
@@ -444,8 +445,9 @@ static void commandFilter(enum Heat heat, uint id, char *params) {
uiFormat(
Network, Warm, NULL, "%sing \3%02d%s %s %s %s",
(heat == Hot ? "Highlight" : "Ignor"), Brown, filters[i].mask,
@@ -107,7 +107,7 @@ index 4c290fc..e566a13 100644
);
}
}
@@ -447,8 +449,8 @@ static void commandUnfilter(enum Heat heat, uint id, char *params) {
@@ -458,8 +460,8 @@ static void commandUnfilter(enum Heat heat, uint id, char *params) {
uiFormat(
id, Cold, NULL, "%s %sing \3%02d%s %s %s %s",
(found ? "No longer" : "Not"), (heat == Hot ? "highlight" : "ignor"),
@@ -118,22 +118,18 @@ index 4c290fc..e566a13 100644
);
}
@@ -472,11 +474,12 @@ static void commandExec(uint id, char *params) {
if (pid < 0) err(EX_OSERR, "fork");
if (pid) return;
+ const char *shell = getenv("SHELL");
+ if (!shell) shell = "/bin/sh";
+
close(STDIN_FILENO);
@@ -488,7 +490,9 @@ static void commandExec(uint id, char *params) {
dup2(execPipe[1], STDOUT_FILENO);
dup2(utilPipe[1], STDERR_FILENO);
-
- const char *shell = getenv("SHELL") ?: "/bin/sh";
+ const char *shell = getenv("SHELL");
+ if (!shell)
+ shell = "/bin/sh";
execl(shell, shell, "-c", params, NULL);
warn("%s", shell);
_exit(EX_UNAVAILABLE);
@@ -501,7 +504,8 @@ static void commandHelp(uint id, char *params) {
@@ -513,7 +517,8 @@ static void commandHelp(uint id, char *params) {
if (pid) return;
char buf[256];
@@ -144,7 +140,7 @@ index 4c290fc..e566a13 100644
execlp("man", "man", "1", "catgirl", NULL);
dup2(utilPipe[1], STDERR_FILENO);
diff --git a/complete.c b/complete.c
index 5835926..0e1de47 100644
index 9e59db5..9ea1192 100644
--- a/complete.c
+++ b/complete.c
@@ -71,7 +71,7 @@ static struct Node *prepend(struct Node *node) {
@@ -166,10 +162,10 @@ index 5835926..0e1de47 100644
}
diff --git a/handle.c b/handle.c
index 2607420..c25c7c0 100644
index a8f054c..1ace1b3 100644
--- a/handle.c
+++ b/handle.c
@@ -295,9 +295,9 @@ static void handleReplyISupport(struct Message *msg) {
@@ -299,9 +299,9 @@ static void handleReplyISupport(struct Message *msg) {
set(&network.setParamModes, setParam);
set(&network.channelModes, channel);
} else if (!strcmp(key, "EXCEPTS")) {
@@ -181,7 +177,7 @@ index 2607420..c25c7c0 100644
}
}
}
@@ -350,7 +350,7 @@ static void handleJoin(struct Message *msg) {
@@ -354,7 +354,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] ? "(" : ""),
@@ -190,7 +186,7 @@ index 2607420..c25c7c0 100644
(msg->params[2] ? "\17) " : ""),
hash(msg->params[0]), msg->params[0]
);
@@ -382,12 +382,14 @@ static void handlePart(struct Message *msg) {
@@ -386,12 +386,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],
@@ -207,7 +203,7 @@ index 2607420..c25c7c0 100644
);
}
@@ -404,12 +406,14 @@ static void handleKick(struct Message *msg) {
@@ -408,12 +410,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],
@@ -224,7 +220,7 @@ index 2607420..c25c7c0 100644
);
completeRemove(id, msg->params[1]);
if (kicked) completeClear(id);
@@ -460,13 +464,15 @@ static void handleQuit(struct Message *msg) {
@@ -464,13 +468,15 @@ static void handleQuit(struct Message *msg) {
id, heat, tagTime(msg),
"\3%02d%s\3\tleaves%s%s",
hash(msg->user), msg->nick,
@@ -242,32 +238,32 @@ index 2607420..c25c7c0 100644
);
}
completeRemove(None, msg->nick);
@@ -718,7 +724,7 @@ static void handleReplyUserModeIs(struct Message *msg) {
for (char *ch = msg->params[1]; *ch; ++ch) {
@@ -732,7 +738,7 @@ static void handleReplyUserModeIs(struct Message *msg) {
if (*ch == '+') continue;
const char *name = UserModes[(byte)*ch];
- catf(&cat, ", +%c%s%s", *ch, (name ? " " : ""), (name ?: ""));
+ catf(&cat, ", +%c%s%s", *ch, (name ? " " : ""), (name ? name : ""));
ptr = seprintf(
- ptr, end, ", +%c%s%s", *ch, (name ? " " : ""), (name ?: "")
+ ptr, end, ", +%c%s%s", *ch, (name ? " " : ""), (name ? name : "")
);
}
uiFormat(
Network, Warm, tagTime(msg),
@@ -757,13 +763,13 @@ static void handleReplyChannelModeIs(struct Message *msg) {
@@ -772,13 +778,13 @@ static void handleReplyChannelModeIs(struct Message *msg) {
assert(param < ParamCap);
catf(
&cat, ", +%c%s%s %s",
ptr = seprintf(
ptr, end, ", +%c%s%s %s",
- *ch, (name ? " " : ""), (name ?: ""),
+ *ch, (name ? " " : ""), (name ? name : ""),
msg->params[param++]
);
} else {
catf(
&cat, ", +%c%s%s",
ptr = seprintf(
ptr, end, ", +%c%s%s",
- *ch, (name ? " " : ""), (name ?: "")
+ *ch, (name ? " " : ""), (name ? name : "")
);
}
}
@@ -790,7 +796,7 @@ static void handleMode(struct Message *msg) {
@@ -805,7 +811,7 @@ static void handleMode(struct Message *msg) {
hash(msg->user), msg->nick,
(set ? "" : "un"),
self.color, msg->params[0],
@@ -276,7 +272,7 @@ index 2607420..c25c7c0 100644
);
}
return;
@@ -947,7 +953,7 @@ static void handleErrorBanListFull(struct Message *msg) {
@@ -962,7 +968,7 @@ static void handleErrorBanListFull(struct Message *msg) {
require(msg, false, 4);
uiFormat(
idFor(msg->params[1]), Warm, tagTime(msg),
@@ -285,7 +281,7 @@ index 2607420..c25c7c0 100644
);
}
@@ -1052,14 +1058,15 @@ static void handleReplyWhoisIdle(struct Message *msg) {
@@ -1067,14 +1073,15 @@ static void handleReplyWhoisIdle(struct Message *msg) {
}
}
char signon[sizeof("0000-00-00 00:00:00")];
@@ -303,7 +299,7 @@ index 2607420..c25c7c0 100644
);
}
@@ -1090,7 +1097,9 @@ static void handleReplyWhoisGeneric(struct Message *msg) {
@@ -1109,7 +1116,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],
@@ -314,7 +310,7 @@ index 2607420..c25c7c0 100644
);
}
@@ -1157,7 +1166,7 @@ static bool isMention(const struct Message *msg) {
@@ -1184,7 +1193,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] : ' ');
@@ -324,10 +320,10 @@ index 2607420..c25c7c0 100644
return true;
}
diff --git a/ui.c b/ui.c
index 6449e27..aa8c376 100644
index 1adcafe..2df8396 100644
--- a/ui.c
+++ b/ui.c
@@ -476,7 +476,7 @@ static size_t windowTop(const struct Window *window) {
@@ -495,7 +495,7 @@ static size_t windowTop(const struct Window *window) {
}
static size_t windowBottom(const struct Window *window) {
@@ -336,7 +332,7 @@ index 6449e27..aa8c376 100644
if (window->scroll) bottom -= SplitLines + MarkerLines;
return bottom;
}
@@ -958,7 +958,6 @@ static void keyCode(int code) {
@@ -978,7 +978,6 @@ static void keyCode(int code) {
break; case KeyMetaGt: scrollTo(window, 0);
break; case KeyMetaLt: scrollTop(window);
@@ -344,7 +340,7 @@ index 6449e27..aa8c376 100644
break; case KeyMetaA: showAuto();
break; case KeyMetaB: edit(id, EditPrevWord, 0);
break; case KeyMetaD: edit(id, EditDeleteNextWord, 0);
@@ -988,6 +987,12 @@ static void keyCode(int code) {
@@ -1008,6 +1007,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);
@@ -358,10 +354,10 @@ index 6449e27..aa8c376 100644
}
diff --git a/url.c b/url.c
index 21f946c..1330d36 100644
index 219a83c..9c721e0 100644
--- a/url.c
+++ b/url.c
@@ -246,7 +246,7 @@ int urlSave(FILE *file) {
@@ -249,7 +249,7 @@ int urlSave(FILE *file) {
if (!url->url) continue;
int error = 0
|| writeString(file, idNames[url->id])
@@ -371,5 +367,5 @@ index 21f946c..1330d36 100644
if (error) return error;
}
--
2.31.1
2.32.0
@@ -1,57 +0,0 @@
From a1592df2eedd841ef8b5ad7edcaabf251f3ab04f Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Sun, 30 May 2021 23:29:26 -0700
Subject: [PATCH] Avoid writing past the end of the status bar
When waddnstr is called with a string that would extend past the
end of the window, the string is truncated, the cursor remains at
the last column, and ERR is returned. If this error is ignored and
the loop continues, the next call to waddnstr overwrites the character
at this column, resulting in a slight visual artifact. When the
window is too small to fit the full status line, it is effectively
truncated by one space on the right, since the string shown for
each channel begins with a space. Additionally, if the last window
is the current window, the space is shown with a colored background.
To fix this, when waddnstr returns ERR, exit the loop in styleAdd()
early return -1 to propogate this error down to the caller.
---
ui.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/ui.c b/ui.c
index aa8c376..2d02ef4 100644
--- a/ui.c
+++ b/ui.c
@@ -374,14 +374,16 @@ static short stylePair(struct Style style) {
return colorPair(Colors[style.fg], Colors[style.bg]);
}
-static void styleAdd(WINDOW *win, const char *str) {
+static int styleAdd(WINDOW *win, const char *str) {
struct Style style = StyleDefault;
while (*str) {
size_t len = styleParse(&style, &str);
wattr_set(win, styleAttr(style), stylePair(style), NULL);
- waddnstr(win, str, len);
+ if (waddnstr(win, str, len) == ERR)
+ return -1;
str += len;
}
+ return 0;
}
static void statusUpdate(void) {
@@ -420,7 +422,8 @@ static void statusUpdate(void) {
if (window->scroll) {
catf(&cat, "~%d ", window->scroll);
}
- styleAdd(status, buf);
+ if (styleAdd(status, buf))
+ break;
}
wclrtoeol(status);
--
2.31.1
@@ -1,4 +1,4 @@
From 78230d9042639147907263f41d9824f917c5c686 Mon Sep 17 00:00:00 2001
From a878ba9c650d4cb25ddf656e4812536456005f6f 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
@@ -10,10 +10,10 @@ with M-l, which restores curses mode when using NetBSD's libcurses.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui.c b/ui.c
index 2d02ef4..ff87124 100644
index 2df8396..2ad1fd8 100644
--- a/ui.c
+++ b/ui.c
@@ -1074,7 +1074,7 @@ void uiRead(void) {
@@ -1091,7 +1091,7 @@ void uiRead(void) {
wint_t ch;
static bool paste, style, literal;
@@ -23,5 +23,5 @@ index 2d02ef4..ff87124 100644
paste = true;
} else if (ret == KEY_CODE_YES && ch == KeyPasteOff) {
--
2.31.1
2.32.0
@@ -1,4 +1,4 @@
From 3568a01d610e33073aa39f4cfadfcacd97509af4 Mon Sep 17 00:00:00 2001
From e3f4f70859054485039e2d8dede1d0b95dd40fa7 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,10 +11,10 @@ status window explicitly.
1 file changed, 1 insertion(+)
diff --git a/ui.c b/ui.c
index ff87124..6819d0a 100644
index 2ad1fd8..64e83d3 100644
--- a/ui.c
+++ b/ui.c
@@ -642,6 +642,7 @@ static void windowReflow(struct Window *window) {
@@ -659,6 +659,7 @@ static void windowReflow(struct Window *window) {
static void resize(void) {
wclear(main);
@@ -23,5 +23,5 @@ index ff87124..6819d0a 100644
for (uint num = 0; num < windows.len; ++num) {
windowReflow(windows.ptrs[num]);
--
2.31.1
2.32.0
@@ -1,4 +1,4 @@
From 12f859151f0cc5376fbbac0b28a1193c20e26f7b Mon Sep 17 00:00:00 2001
From 80dac47ee3aa26290cda962ab2531afb054bf47a 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
@@ -10,10 +10,10 @@ crucial feature.
1 file changed, 2 deletions(-)
diff --git a/ui.c b/ui.c
index 6819d0a..50b1559 100644
index 64e83d3..407672c 100644
--- a/ui.c
+++ b/ui.c
@@ -669,7 +669,6 @@ static void windowList(const struct Window *window) {
@@ -686,7 +686,6 @@ static void windowList(const struct Window *window) {
char buf[TimeCap];
strftime(buf, sizeof(buf), uiTime.format, localtime(&line->time));
@@ -21,7 +21,7 @@ index 6819d0a..50b1559 100644
printf("%s ", buf);
bool align = false;
@@ -685,7 +684,6 @@ static void windowList(const struct Window *window) {
@@ -702,7 +701,6 @@ static void windowList(const struct Window *window) {
size_t tab = strcspn(str, "\t");
if (tab < len) len = tab;
@@ -30,5 +30,5 @@ index 6819d0a..50b1559 100644
str += len;
}
--
2.31.1
2.32.0
+1 -1
View File
@@ -1 +1 @@
1.8 r1
1.9a r0