[Libvir] [PATCH 2/8] Compile libvirt under Windows (Cygwin)
Jim Meyering
jim at meyering.net
Mon Nov 26 10:26:38 UTC 2007
Jim Meyering <jim at meyering.net> wrote:
> "Richard W.M. Jones" <rjones at 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;
Of course, it'd have to be ->, not "."
More information about the libvir-list
mailing list