bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen


From: Paul Eggert
Subject: Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen
Date: Thu, 21 May 2015 09:51:42 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 05/21/2015 09:36 AM, Filipe Brandenburger wrote:
Any suggestions of what's the best way to solve this?

I suggest doing what Emacs does.  Put this in a header somewhere:

#if O_BINARY
# define FOPEN_BINARY "b"
# define FOPEN_TEXT "t"
#else
# define FOPEN_BINARY ""
# define FOPEN_TEXT ""
#endif

and then call 'popen (cmd, "r" FOPEN_BINARY)'. Emacs does the same thing with fopen of course. In practice this is good enough.



reply via email to

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