return pakfire_pty_activity(pty, &pty->stdout, events);
}
+static void pakfire_pty_make_raw(struct termios* termios) {
+ // Set input flags
+ termios->c_iflag |= (
+ // Ignore framing errors and parity errors
+ IGNPAR
+ );
+
+ // Clear input flags
+ termios->c_iflag &= ~(
+ // Strip off eighth bit
+ ISTRIP |
+
+ // Translate NL to CR on input
+ INLCR |
+
+ // Ignore carriage return on input
+ IGNCR |
+
+ // Translate carriage return to newline on input (unless IGNCR is set)
+ ICRNL |
+
+ // Enable XON/XOFF flow control on output
+ IXON |
+
+ // Typing any character will restart stopped output
+ IXANY |
+
+ // Enable XON/XOFF flow control on input
+ IXOFF |
+
+ // Map uppercase characters to lowercase on input
+ IUCLC
+ );
+
+ // Clear local flags
+ termios->c_lflag &= ~(
+ // Send the SIGTTOU signal to the process group of a background process
+ // which tries to write to its controlling terminal
+ TOSTOP |
+
+ // When any of the characters INTR, QUIT, SUSP, or DSUSP are received,
+ // generate the corresponding signal
+ ISIG |
+
+ // Enable canonical mode
+ ICANON |
+
+ // Echo input characters
+ ECHO |
+
+ // If ICANON is also set, the ERASE character erases the preceding input character,
+ // and WERASE erases the preceding word.
+ ECHOE |
+
+ // If ICANON is also set, the KILL character erases the current line
+ ECHOK |
+
+ // If ICANON is also set, echo the NL character even if ECHO is not set.
+ ECHONL |
+
+ // Enable implementation-defined input processing. This flag, as well as ICANON
+ // must be enabled for the special characters EOL2, LNEXT, REPRINT, WERASE to be
+ // interpreted, and for the IUCLC flag to be effective.
+ IEXTEN
+ );
+
+ // Set output flags
+ termios->c_oflag |= (
+ // Map NL to CR-NL on output
+ ONLCR |
+
+ // Enable implementation-defined output processing
+ OPOST
+ );
+}
+
static int pakfire_pty_enable_raw_mode(struct pakfire_pty* pty) {
struct termios raw_attrs;
int same;
raw_attrs = pty->stdin.attrs;
// Enable raw mode
- cfmakeraw(&raw_attrs);
+ pakfire_pty_make_raw(&raw_attrs);
if (!same)
raw_attrs.c_oflag = pty->stdin.attrs.c_oflag;
raw_attrs = pty->stdout.attrs;
// Enable raw mode
- cfmakeraw(&raw_attrs);
+ pakfire_pty_make_raw(&raw_attrs);
raw_attrs.c_iflag = pty->stdout.attrs.c_iflag;
raw_attrs.c_lflag = pty->stdout.attrs.c_lflag;