Subject: Re: xterm jump scrolling on sparc64
To: None <tech-x11@NetBSD.org>
From: Matthias Scheler <tron@zhadum.de>
List: tech-x11
Date: 06/01/2004 13:28:33
In article <20040530230430.GB6706@shrubbery.net>,
john heasley <heas@shrubbery.net> writes:
> Question before I commit this though, what platform/OS takes a long for
> FIONREAD? SUS says int and but I found miscellaneous references on google
> suggesting that there are some which use long (IRIX on LP64 and apprently
> windows).
The safe version would be:
#if defined(FIONREAD)
#ifdef __NetBSD__
int arg = 0;
ioctl(fd, FIONREAD, &arg);
return arg;
#else
long arg = 0;
ioctl(fd, FIONREAD, (char *) &arg);
return (int) arg;
#endif
#elif defined(__CYGWIN__)
But if SUS indeed says that FIONREAD expects an "int" argument you
should better write like this:
#if defined(FIONREAD)
#ifdef SGIArchitecture
long arg = 0;
ioctl(fd, FIONREAD, (char *) &arg);
return (int) arg;
#else
int arg = 0;
ioctl(fd, FIONREAD, &arg);
return arg;
#endif
#elif defined(__CYGWIN__)
> So, is that patch ok for our tree, given there doesn't appear to be an
> existing X define to choose otherwise?
Some people use sources from "xsrc" on non-NetBSD machines, too. We
should really try to keep the portable.
Kind regards
--
Matthias Scheler http://scheler.de/~matthias/