From 1e226593ef9860237ec08ad66affcb7da7138f5d Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Thu, 13 Feb 2020 21:57:55 -0500 Subject: [PATCH] Rename procPipe to utilPipe --- chat.c | 16 ++++++++-------- chat.h | 4 ++-- command.c | 2 +- ui.c | 4 ++-- url.c | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/chat.c b/chat.c index c142bc9..7bb0538 100644 --- a/chat.c +++ b/chat.c @@ -78,11 +78,11 @@ static void exitSave(void) { uint32_t hashInit; -int procPipe[2] = { -1, -1 }; +int utilPipe[2] = { -1, -1 }; -static void pipeRead(void) { +static void utilRead(void) { char buf[1024]; - ssize_t len = read(procPipe[0], buf, sizeof(buf) - 1); + ssize_t len = read(utilPipe[0], buf, sizeof(buf) - 1); if (len < 0) err(EX_IOERR, "read"); if (!len) return; buf[len - 1] = '\0'; @@ -221,17 +221,17 @@ int main(int argc, char *argv[]) { signal(SIGCHLD, signalHandler); sig_t cursesWinch = signal(SIGWINCH, signalHandler); - int error = pipe(procPipe); + int error = pipe(utilPipe); if (error) err(EX_OSERR, "pipe"); fcntl(irc, F_SETFD, FD_CLOEXEC); - fcntl(procPipe[0], F_SETFD, FD_CLOEXEC); - fcntl(procPipe[1], F_SETFD, FD_CLOEXEC); + fcntl(utilPipe[0], F_SETFD, FD_CLOEXEC); + fcntl(utilPipe[1], F_SETFD, FD_CLOEXEC); struct pollfd fds[3] = { { .events = POLLIN, .fd = STDIN_FILENO }, { .events = POLLIN, .fd = irc }, - { .events = POLLIN, .fd = procPipe[0] }, + { .events = POLLIN, .fd = utilPipe[0] }, }; while (!self.quit) { int nfds = poll(fds, ARRAY_LEN(fds), -1); @@ -239,7 +239,7 @@ int main(int argc, char *argv[]) { if (nfds > 0) { if (fds[0].revents) uiRead(); if (fds[1].revents) ircRecv(); - if (fds[2].revents) pipeRead(); + if (fds[2].revents) utilRead(); } if (signals[SIGHUP]) self.quit = "zzz"; diff --git a/chat.h b/chat.h index 0ef0952..b852c44 100644 --- a/chat.h +++ b/chat.h @@ -28,8 +28,6 @@ typedef unsigned char byte; -int procPipe[2]; - enum Color { White, Black, Blue, Green, Red, Brown, Magenta, Orange, Yellow, LightGreen, Cyan, LightCyan, LightBlue, Pink, Gray, LightGray, @@ -147,6 +145,8 @@ const char *commandIsNotice(size_t id, const char *input); const char *commandIsAction(size_t id, const char *input); void commandComplete(void); +int utilPipe[2]; + enum { UtilCap = 16 }; struct Util { size_t argc; diff --git a/command.c b/command.c index f801666..ffbea9f 100644 --- a/command.c +++ b/command.c @@ -207,7 +207,7 @@ static void commandHelp(size_t id, char *params) { snprintf(buf, sizeof(buf), "ip%s$", (params ? params : "COMMANDS")); setenv("LESS", buf, 1); execlp("man", "man", "1", "catgirl", NULL); - dup2(procPipe[1], STDERR_FILENO); + dup2(utilPipe[1], STDERR_FILENO); warn("man"); _exit(EX_UNAVAILABLE); } diff --git a/ui.c b/ui.c index 2fbb720..115d554 100644 --- a/ui.c +++ b/ui.c @@ -572,8 +572,8 @@ static void notify(size_t id, const char *str) { if (pid) return; close(STDIN_FILENO); - dup2(procPipe[1], STDOUT_FILENO); - dup2(procPipe[1], STDERR_FILENO); + dup2(utilPipe[1], STDOUT_FILENO); + dup2(utilPipe[1], STDERR_FILENO); execvp(util.argv[0], (char *const *)util.argv); warn("%s", util.argv[0]); _exit(EX_CONFIG); diff --git a/url.c b/url.c index bf3d948..43c2ee9 100644 --- a/url.c +++ b/url.c @@ -107,8 +107,8 @@ static void urlOpen(const char *url) { if (pid) return; close(STDIN_FILENO); - dup2(procPipe[1], STDOUT_FILENO); - dup2(procPipe[1], STDERR_FILENO); + dup2(utilPipe[1], STDOUT_FILENO); + dup2(utilPipe[1], STDERR_FILENO); if (urlOpenUtil.argc) { struct Util util = urlOpenUtil; utilPush(&util, url); @@ -156,8 +156,8 @@ static void urlCopy(const char *url) { } dup2(rw[0], STDIN_FILENO); - dup2(procPipe[1], STDOUT_FILENO); - dup2(procPipe[1], STDERR_FILENO); + dup2(utilPipe[1], STDOUT_FILENO); + dup2(utilPipe[1], STDERR_FILENO); close(rw[0]); if (urlCopyUtil.argc) { execvp(urlCopyUtil.argv[0], (char *const *)urlCopyUtil.argv);