aboutsummaryrefslogtreecommitdiff
path: root/bb.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-06-17 14:52:38 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-06-17 14:52:38 -0700
commit8d5e68d4441228b0c101940a9b7189938e755130 (patch)
treeec2c60a8ec38c24f036617d5c069b624fe50a882 /bb.c
parentff800b2377883f9df5b73cd5a4bb9e98141d835e (diff)
Fix for term attrs getting messed up by Fish shell
Diffstat (limited to 'bb.c')
-rw-r--r--bb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/bb.c b/bb.c
index a4f3d7b..8aed841 100644
--- a/bb.c
+++ b/bb.c
@@ -187,9 +187,13 @@ void update_term_size(int sig)
*/
void init_term(void)
{
+ static int first_time = 1;
tty_in = fopen("/dev/tty", "r");
tty_out = fopen("/dev/tty", "w");
- tcgetattr(fileno(tty_out), &orig_termios);
+ if (first_time) {
+ tcgetattr(fileno(tty_out), &orig_termios);
+ first_time = 0;
+ }
memcpy(&bb_termios, &orig_termios, sizeof(bb_termios));
cfmakeraw(&bb_termios);
bb_termios.c_cc[VMIN] = 0;