texinfo-devel
[Top][All Lists]
Advanced

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

Re: [5452] info/pseudotty.c


From: Gavin Smith
Subject: Re: [5452] info/pseudotty.c
Date: Tue, 6 May 2014 11:49:47 +0100

On Wed, Apr 16, 2014 at 10:19 PM, Gavin Smith <address@hidden> wrote:
> On Wed, Apr 16, 2014 at 10:02 PM, Karl Berry <address@hidden> wrote:
>>     +#define _GNU_SOURCE
>>
>>     2014-04-16  Gavin Smith  <address@hidden>
>>
>>         * info/pseudotty.c: #define _GNU_SOURCE to get getpt and
>>         ptsname declarations from <stdlib.h>.
>>
>> I am a bit doubtful that defining _GNU_SOURCE is going to be portable.
>> But I know we #define it in system.h, so I suppose it works out for
>> other reasons on, say, BSD?
>>
> The code here creates a pseudoterminal following the example in the
> glibc manual. Some of these functions are marked as GNU extensions.
> ptsname isn't, but seems to require a definition like _GNU_SOURCE.
> (The ptsname man page I have installed says to #define _XOPEN_SOURCE -
> presumably this would be more portable.) Hopefully there is some
> portable way to create a pseudoterminal.

I changed it to _XOPEN_SOURCE, but on reflection, this doesn't make
the functions used any more portable. It exposes different
declarations in header files, but doesn't make these functions appear
on other systems. (And getpt() is a GNU extension and should have
_GNU_SOURCE. I think there was no error message about getpt() because
it returns an int - I'll have to find what compiler flag complains
about using functions without them having a declaration.) Maybe there
is some wrapper in gnulib (I noticed there were wrappers for other C
library functions in there); failing that, I'll have to see if there
are other, more portable functions for this.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]