lchat

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

commit b54648dcb7336f1b4beb9349d14a03c9f7be800e
parent 58ad5be221963b990efdc0087e1203080e1f608a
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date:   Fri, 23 Oct 2015 23:19:57 +0200

integrate slackline for line edit handling

Diffstat:
lchat.c | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lchat.c b/lchat.c @@ -4,6 +4,8 @@ #include <termios.h> #include <unistd.h> +#include "slackline.h" + struct termios origin_term; void @@ -17,12 +19,14 @@ int main(void) { struct termios term; + struct slackline *sl = sl_init(); int fd = STDIN_FILENO; int c; if (isatty(fd) == 0) err(EXIT_FAILURE, "isatty"); + /* preprate terminal reset on exit */ if (tcgetattr(fd, &origin_term) == -1) err(EXIT_FAILURE, "tcgetattr"); @@ -42,10 +46,11 @@ main(void) setbuf(stdout, NULL); while ((c = getchar()) != 13) { - //printf("c: %d\r\n", c); - if (c >= 32 && c < 127) - putchar(c); + sl_keystroke(sl, c); + printf("c: %d: buf: %s\r\n", c, sl->buf); } + puts("\r"); + return EXIT_SUCCESS; }