lchat

A line oriented chat front end for ii.
git clone git://git.suckless.org/lchat
Log | Files | Refs

commit d03daa3fb2b41a1a969b9d4fdb0197cea471d4a0
parent 3e18627b65da00ad5282946bd93e112aabb99491
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date:   Tue,  5 Jan 2016 22:45:16 +0100

add the possibility for output line transformaton

Diffstat:
lchat.1 | 5+++++
lchat.c | 6+++++-
2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lchat.1 b/lchat.1 @@ -79,6 +79,11 @@ Default path is the current working directory. .Bl -tag -width Ds .It .bellmatch contains regular expressions that controls bell ring on matching input. +.It .filter +If this file exists and has executable permissions, it is used as a filter +program for the output lines. +This program should read raw lines from stdin and outputs filtered or +transformed lines to stdout. .El .Sh SEE ALSO .Xr tail 1 , diff --git a/lchat.c b/lchat.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Jan Klemkow <j.klemkow@wemelug.de> + * Copyright (c) 2015-2016 Jan Klemkow <j.klemkow@wemelug.de> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -215,6 +215,10 @@ main(int argc, char *argv[]) /* open external source */ snprintf(tail_cmd, sizeof tail_cmd, "exec tail -n %zd -f %s", history_len, out_file); + + if (access(".filter", X_OK) == 0) + strlcat(tail_cmd, " | ./.filter", sizeof tail_cmd); + if ((tail_fh = popen(tail_cmd, "r")) == NULL) err(EXIT_FAILURE, "unable to open pipe to tail command");