Re: [PATCH 2/8] Compile libvirt under Windows (Cygwin)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]