Browse Source

Output raw to standard error if it is not a terminal

master
Causal Agent 6 months ago
parent
commit
2a6e3f2d02
Signed by: Curtis McEnroe <june@causal.agency> GPG Key ID: CEA2F97ADCFCD77C
2 changed files with 5 additions and 0 deletions
  1. 3
    0
      catgirl.1
  2. 2
    0
      irc.c

+ 3
- 0
catgirl.1 View File

@@ -90,6 +90,9 @@ the same as the nickname.
Show raw IRC protocol in the
.Sy <raw>
window.
If standard error is not a terminal,
output raw IRC protocol
to standard error.
.
.It Fl w Ar pass
Log in with

+ 2
- 0
irc.c View File

@@ -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);

Loading…
Cancel
Save