summary refs log tree commit diff
path: root/command.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-10-02 19:38:37 -0400
committerJune McEnroe <june@causal.agency>2020-10-02 19:38:37 -0400
commitf7f5acbbe2a848d2c827aed0fe8410e48300c1e9 (patch)
treea4967b2ac419cfde81a951b65e47fde6481d6db9 /command.c
parentUse WHO for /ops (diff)
downloadcatgirl-f7f5acbbe2a848d2c827aed0fe8410e48300c1e9.tar.gz
catgirl-f7f5acbbe2a848d2c827aed0fe8410e48300c1e9.zip
Double up /help for server help
While the automatic search via LESS is neat, I don't think it's very
useful. Just always open the manual to the COMMANDS section, and fix it
to append to LESS rather than replace it.
Diffstat (limited to '')
-rw-r--r--command.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/command.c b/command.c
index 92f1271..3af1246 100644
--- a/command.c
+++ b/command.c
@@ -421,14 +421,20 @@ static void commandExec(uint id, char *params) {
 
 static void commandHelp(uint id, char *params) {
 	(void)id;
-	uiHide();
 
+	if (params) {
+		ircFormat("HELP :%s\r\n", params);
+		replies.help++;
+		return;
+	}
+
+	uiHide();
 	pid_t pid = fork();
 	if (pid < 0) err(EX_OSERR, "fork");
 	if (pid) return;
 
 	char buf[256];
-	snprintf(buf, sizeof(buf), "ip%s$", (params ?: "COMMANDS"));
+	snprintf(buf, sizeof(buf), "%spCOMMANDS$", (getenv("LESS") ?: ""));
 	setenv("LESS", buf, 1);
 	execlp("man", "man", "1", "catgirl", NULL);
 	dup2(utilPipe[1], STDERR_FILENO);