sic

personal fork with prompts, tmux splits
git clone git://git.garbash.com/alex/sic
Log | Files | Refs | README | LICENSE

commit 706e7fb24b632e3fba979deb6850c65e178a0560
parent 2fb63a6e1e686cc5a137a7b106ce76bd5818a5aa
Author: alex <alex@garbash.com>
Date:   Thu, 14 Oct 2021 23:36:28 -0400

args: Add -P option to print a channel> prompt

This is super useful especially when run under a setup where the
stdout is redirected to a file and another terminal (usually a
tmux split) is following that file (leaving this terminal as
a "prompt only" command window).

Diffstat:
Msic.1 | 6++++++
Msic.c | 6++++++
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/sic.1 b/sic.1 @@ -7,6 +7,7 @@ sic \- simple irc client .IR host ] .RB [ \-p .IR port ] +.RB [ \-P ] .RB [ \-n .IR nick ] .RB [ \-k @@ -26,6 +27,11 @@ Overrides the default host (localhost) .BI \-p " port" Overrides the default port (6667) .TP +.B \-P +Prints a prompt containing current channel to stderr after each input. +Useful especially if stdout is redirected to a file for viewing in +another terminal. +.TP .BI \-n " nick" Override the default nick ($USER) .TP diff --git a/sic.c b/sic.c @@ -17,6 +17,7 @@ char *argv0; static char *host = DEFAULT_HOST; static char *port = DEFAULT_PORT; static char *password; +static int prompt = 0; static char nick[32]; static char bufin[4096]; static char bufout[4096]; @@ -160,6 +161,9 @@ main(int argc, char *argv[]) { case 'p': port = EARGF(usage()); break; + case 'P': + prompt = 1; + break; case 'n': strlcpy(nick, EARGF(usage()), sizeof nick); break; @@ -218,6 +222,8 @@ main(int argc, char *argv[]) { if(fgets(bufin, sizeof bufin, stdin) == NULL) eprint("sic: broken pipe\n"); parsein(bufin); + if (prompt) + fprintf(stderr, "%s> ", channel); } } return 0;