void init_term(void) { struct termios attr; tcgetattr(STDIN_FILENO, &attr); g_term_data.saved_attr = attr; if (isatty(fileno(stdin))) { g_pid_loop->is_in_loop = 1; attr.c_lflag &= ~(ICANON | ECHO); } else g_pid_loop->is_in_loop = 0; tcsetattr(STDIN_FILENO, TCSANOW, &attr); init_terminal_data(); signal(SIGINT, signal_handler); g_pid_loop->heredoc = 0; }
int GetScreenColumns(void) { init_terminal_data(); return tgetnum ("co"); }
int GetScreenRows(void) { init_terminal_data(); return tgetnum("li"); }