diff options
author | C. McEnroe | 2021-01-09 17:58:29 -0500 |
---|---|---|
committer | C. McEnroe | 2021-01-09 17:58:29 -0500 |
commit | a324795b8610b7c3e5626ac72d202ce6207066d7 (patch) | |
tree | 4f340e00b8d3e6e637444f645f8b5856b77665df /chat.c | |
parent | bf70fcbfedbe544a7e8dd1f444e8abe1bbd31da1 (diff) |
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?
Diffstat (limited to 'chat.c')
-rw-r--r-- | chat.c | 12 |
1 files changed, 9 insertions, 3 deletions
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; |