Introduction
Introduction Statistics Contact Development Disclaimer Help
lchat: clean up terminal preparation - lchat - A line oriented chat front end f…
git clone git://git.suckless.org/lchat
Log
Files
Refs
README
---
commit afd762fabb08a2afc1230bec321756d7c2946764
parent 441c734ba664e797e585697e65eb18cf4ebaf97a
Author: Tom Schwindl <[email protected]>
Date: Sat, 17 Sep 2022 16:07:48 +0200
lchat: clean up terminal preparation
- reuse the value of `origin_term' instead of calling tcgetattr(3) twice
- change the following termios flags:
IMAXBEL - is an extension and does not provide much "real" value
OPOST - is mostly IB and thus not very useful
ECHONL - only has an effect if ICANON is set, which isn't the case for us
Diffstat:
M lchat.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/lchat.c b/lchat.c
@@ -25,7 +25,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <term.h>
#include <termios.h>
#include <unistd.h>
@@ -248,21 +247,18 @@ main(int argc, char *argv[])
else
printf("\033]0;%s\a", title);
- /* preprate terminal reset on exit */
+ /* prepare terminal reset on exit */
if (tcgetattr(fd, &origin_term) == -1)
die("tcgetattr:");
+ term = origin_term;
+
if (atexit(exit_handler) == -1)
die("atexit:");
- /* prepare terminal */
- if (tcgetattr(fd, &term) == -1)
- die("tcgetattr:");
-
- /* TODO: clean up this block. copied from cfmakeraw(3) */
- term.c_iflag &= ~(IMAXBEL|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
-// term.c_oflag &= ~OPOST;
- term.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
+ term.c_iflag &= ~(BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+ term.c_oflag &= ~OPOST;
+ term.c_lflag &= ~(ECHO|ICANON|IEXTEN);
term.c_cflag &= ~(CSIZE|PARENB);
term.c_cflag |= CS8;
term.c_cc[VMIN] = 1;
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.