diff options
author | June McEnroe <june@causal.agency> | 2019-02-25 17:00:28 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-02-25 17:00:28 -0500 |
commit | 2a6e3f2d02951fea389db6767f5e4ed657964d80 (patch) | |
tree | e84d46fa5ee64aa874972adaa098aa4a8012d124 /irc.c | |
parent | Update tag colors (diff) | |
download | catgirl-2a6e3f2d02951fea389db6767f5e4ed657964d80.tar.gz catgirl-2a6e3f2d02951fea389db6767f5e4ed657964d80.zip |
Output raw to standard error if it is not a terminal
Diffstat (limited to 'irc.c')
-rw-r--r-- | irc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/irc.c b/irc.c index a8dc2dd..2ad6d19 100644 --- a/irc.c +++ b/irc.c @@ -111,6 +111,7 @@ void ircFmt(const char *format, ...) { va_end(ap); if (!buf) err(EX_OSERR, "vasprintf"); if (self.raw) { + if (!isatty(STDERR_FILENO)) fprintf(stderr, "<<< %.*s\n", len - 2, buf); uiFmt(TagRaw, UICold, "\3%d<<<\3 %.*s", IRCWhite, len - 2, buf); } ircWrite(buf, len); @@ -142,6 +143,7 @@ retry: while (NULL != (crlf = memmem(line, &buf[len] - line, "\r\n", 2))) { crlf[0] = '\0'; if (self.raw) { + if (!isatty(STDERR_FILENO)) fprintf(stderr, ">>> %s\n", line); uiFmt(TagRaw, UICold, "\3%d>>>\3 %s", IRCGray, line); } handle(line); |