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

Re: Incompatibility between ncurses and libc6?



In article <cistron.Pine.LNX.3.96.981031162121.1948A-100000@cnhobbes.ml.org>,
Brandon Mitchell  <bhmit1@mail.wm.edu> wrote:
>>      70 #ifndef NCURSES_CONST
>>      71 #define NCURSES_CONST /*nothing*/
>>      72 #endif
>>      73
>>      74 /* Assume Posix termio if we have the header and function */
>>      75 #if HAVE_TERMIOS_H && HAVE_TCGETATTR
>
>Yup, that looks like a parse error.  I don't think #if is a valid
>preprocessor macro, but I may be wrong.

You're wrong :) #if is valid, but it expects a valid expression after
it - and if for example HAVE_TCGETATTR is not defined, it's
expanded to

	#if HAVE_TERMIOS_H &&

which sure looks like being capable of causing a parse error to me..

>Personally, I would do it with 2
>separate #ifdef lines.  Does someone who knows this a little better than I
>do have an ideal fix?

I'd do

	#if defined(HAVE_TERMIOS_H) && defined(HAVE_TCGETATTR)

But ofcourse you have to make sure that nobody does a

	#define HAVE_TERMIOS_H 0 /* Nope, don't have it */

because then ofcourse HAVE_TERMIOS_H _would_ be defined anyway
and the above test would be correct after all.. 

But if this is autoconfed (sure looks like it) that is not the case,
HAVE_XXX is defined (as 1) or not defined at all.

Mike.
-- 
  "Did I ever tell you about the illusion of free will?"
    -- Sheriff Lucas Buck, ultimate BOFH.


Reply to: