Jim Meyering <jim@xxxxxxxxxxxx> wrote: > "Richard W.M. Jones" <rjones@xxxxxxxxxx> 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; Of course, it'd have to be ->, not "." -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list