eel

formatter for ii(1) logs
Log | Files | Refs | README

commit f4a5f85fe625f72cd1f4636a603b0b9cd9ced0cb
parent f5915e7f398ffa87c9ca999c4fd88125c060e402
Author: Josuah Demangeon <mail@josuah.net>
Date:   Thu,  7 Jun 2018 21:17:46 +0200

add a man page and edit time column

Diffstat:
Meel.c | 9+++++----
Ashuntty.1 | 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 4 deletions(-)

diff --git a/eel.c b/eel.c @@ -6,7 +6,7 @@ #define RFC1459_LEN 512 #define NICK_MAX 256 #define NICK_COL 10 -#define TIME_COL 6 +#define TIME_COL 5 #define COLS_MAX 80 char * @@ -40,14 +40,14 @@ tail: void print_msg(time_t time, char *nick, int same, char *msg) { - char time_str[TIME_COL]; + char time_str[TIME_COL + 1]; if (same) nick = ""; else putchar('\n'); - strftime(time_str, TIME_COL, "%H:%M", localtime(&time)); + strftime(time_str, sizeof(time_str), "%H:%M", localtime(&time)); while ((msg = print_row(time_str, nick, msg))) { time_str[0] = '\0'; nick = ""; @@ -80,11 +80,12 @@ int main(void) { time_t time; - char *nick, *msg, line[RFC1459_LEN + 1], last[NICK_MAX]; + char *nick, *msg, last[NICK_MAX], line[RFC1459_LEN + 1]; time = 0; nick = msg = NULL; memset(last, 0, sizeof(last)); + while (fgets(line, sizeof(line), stdin) != NULL) { line[strcspn(line, "\n")] = '\0'; if (parse_msg(line, &time, &nick, &msg) < 0) { diff --git a/shuntty.1 b/shuntty.1 @@ -0,0 +1,70 @@ +.Dd $Mdocdate: June 06 2018$ +.Dt SHUNTTY 1 +.Os +. +. +.Sh NAME +. +.Nm shuntty +.Nd shunt tty input/output into a pipe +. +. +.Sh SYNOPSIS +. +.Nm +.Op Ar prompt +. +. +.Sh DESCRIPTION +. +The +.Nm +utility reads lines from standard input, and keys from the current +terminal (whatever stderr is), and print the keys entered by the +user to standard output while enter is pressed. +. +.Pp +It separates the standard input and the user input: if a line comes +from standard input while the user type, it gets printed above and +the beginning of the user input gets moved to the bottom. +. +. +.Sh EXAMPLES +. +Display lines from an +.Xr ii 1 +.Pa out +file and print commands from the user in the +.Pa in +file: +.Dl tail -f ./out | shuntty >in +. +.Pp +Do the same but format the output with +.Xr eel 1 +before displaying it: +.Dl tail -f ./out | eel | shuntty >in +. +. +.Sh SEE ALSO +. +.Xr eel 1 , +.Xr ii 1 , +.Xr tail 1 +. +. +.Sh AUTHORS +. +.An Josuah Demangeon +.Aq Mt mail@josuah.net +. +. +.Sh CAVEATS +. +.Nm +currently read the input character per character without buffering. +. +. +.Sh BUGS +. +Input larger than the terminal window is not handled.