Conversation
Include missing header of isatty().
| #endif | ||
|
|
||
| #if defined(unix) || (defined(__MWERKS__) && defined(macintosh)) /* pxm */ | ||
| #if defined(unix) || defined(__NetBSD__) || (defined(__MWERKS__) && defined(macintosh)) /* pxm */ |
There was a problem hiding this comment.
If my understanding is correct, a fix like this is necessary because NetBSD (likely via pkgsrc) builds with strict C standard flags, which don't define the non-standard unix macro.
But then, a more portable alternative that works on all Unix and Unix-ish systems, not just for NetBSD, should be checking __unix__ instead:
#if defined(unix) || defined(__unix__) || (defined(__MWERKS__) && defined(macintosh)) /* pxm */
Side observation: That __MWERKS__ && macintosh no longer belongs there, either. It should be this instead:
#if defined(__unix) || defined(__unix__) || defined(__APPLE__)
There was a problem hiding this comment.
I don't think NetBSD ever used unix, but I just tried and __unix__ works (default compiler flags). Should I update the PR or will you just fix the whole line yourself?
And yes, this was noticed when updating the pkgsrc package.
There was a problem hiding this comment.
Plain unix without any leading underscore stopped being an acceptable macro since ANSI C89, and probably even before that, because it was polluting the global namespace. It's either __unix or __unix__, depending on the actual Unix flavour, and I think all modern Unix compilers define both, so we should be good on that front.
Should I update the PR or will you just fix the whole line yourself?
I will make that change no problem -- unless you beat me to it ;-)
Include missing header of isatty().