Rev 119 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
/*
* Copyright (c) 2019 The PLANIX Project,
* All rights reserved.
*
* The Berkeley software License Agreement specifies the terms
* and conditions for redistribution.
*
*/
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
struct termios orig_termios;
void
disable_raw()
{
tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}
void
enable_raw()
{
tcgetattr(STDIN_FILENO, &orig_termios);
atexit(disable_raw);
struct termios raw = orig_termios;
raw.c_iflag &= ~(IXON);
raw.c_lflag &= ~(ECHO | ICANON | ISIG);
tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
}