From a324795b8610b7c3e5626ac72d202ce6207066d7 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sat, 9 Jan 2021 17:58:29 -0500 Subject: Allow configuring the upper bound of the hash function This allows limiting the nick colors used to the 16-color terminal set without modifying the TERM environment variable. Produces different results from just using the default configuration in a 16-color terminal, but what can you do? --- chat.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'chat.c') diff --git a/chat.c b/chat.c index 016d604..fd2b89a 100644 --- a/chat.c +++ b/chat.c @@ -87,8 +87,6 @@ static void exitSave(void) { } } -uint32_t hashInit; - uint execID; int execPipe[2] = { -1, -1 }; int utilPipe[2] = { -1, -1 }; @@ -117,6 +115,14 @@ static void utilRead(void) { } } +uint32_t hashInit; +uint32_t hashBound = 75; + +static void parseHash(char *str) { + hashInit = strtoul(str, &str, 0); + if (*str) hashBound = strtoul(&str[1], NULL, 0); +} + static volatile sig_atomic_t signals[NSIG]; static void signalHandler(int signal) { signals[signal] = 1; @@ -179,7 +185,7 @@ int main(int argc, char *argv[]) { switch (opt) { break; case '!': insecure = true; break; case 'C': utilPush(&urlCopyUtil, optarg); - break; case 'H': hashInit = strtoul(optarg, NULL, 0); + break; case 'H': parseHash(optarg); break; case 'N': utilPush(&uiNotifyUtil, optarg); break; case 'O': utilPush(&urlOpenUtil, optarg); break; case 'R': self.restricted = true; -- cgit 1.4.1