
"Richard W.M. Jones" <rjones@redhat.com> wrote:
'cfmakeraw' is a BSD function. If we don't have it, inline the equivalent code instead. ... Index: src/console.c +#ifdef HAVE_CFMAKERAW cfmakeraw(&rawattr); +#else + rawattr.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP + | INLCR | IGNCR | ICRNL | IXON); + rawattr.c_oflag &= ~OPOST; + rawattr.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + rawattr.c_cflag &= ~(CSIZE | PARENB); + rawattr.c_cflag |= CS8; +#endif
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &rawattr) < 0) { fprintf(stderr, _("unable to set tty attributes: %s\n"),
Hi Rich, I like to avoid in-function #ifdefs. To that end, what do you think about a function like this: #ifdef HAVE_CFMAKERAW static void cfmakeraw (whatever) { rawattr.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); rawattr.c_oflag &= ~OPOST; rawattr.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); rawattr.c_cflag &= ~(CSIZE | PARENB); rawattr.c_cflag |= CS8; } #ifdef HAVE_CFMAKERAW Then you don't have to change the code that *uses* cfmakeraw.