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

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

Re: [PATCH 0/4] Cross compiling sharutils


From: Bruce Korb
Subject: Re: [PATCH 0/4] Cross compiling sharutils
Date: Wed, 20 May 2015 20:51:16 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 05/19/15 19:56, Eli Zaretskii wrote:
Date: Tue, 19 May 2015 19:57:25 -0600
From: Eric Blake <address@hidden>
Cc: bug-gnu-utils <address@hidden>

That is, the few platforms where O_BINARY is non-zero probably already
support "rb" as a mode for popen (are there any besides Cygwin and mingw?).

DJGPP.

That answers the question, "Does popen support "rb" as an open mode?"
The other question is:  "Is O_BINARY non-zero on DJGPP, too?"  I would expect.

Actually, since we're also dealing with glibc, which is perfect in every way
and has no need of facilitating cross platform development, O_BINARY
is not defined:

$ cc -o tmp tmp.c
tmp.c: In function 'main':
tmp.c:7:54: error: 'O_BINARY' undeclared (first use in this function)
     printf("O_BINARY has the value %1$u (0x%1$X)\n", O_BINARY);

so it is actually necessary to add kludges for a platform that doesn't define 
it.

#if defined(O_BINARY) && (O_BINARY != 0)
# define READ_BINARY_MODE  "rb"
#else
# define READ_BINARY_MODE "r"
#endif

It seems one or two other projects have stubbed their toes, too:

$ grep -w O_BINARY $list
/usr/include/mysql/my_global.h:#ifndef O_BINARY
/usr/include/mysql/my_global.h:#define O_BINARY 0       /* Flag to my_open for 
binary files */
/usr/include/mysql/my_global.h:#define FILE_BINARY      O_BINARY /* Flag to 
my_fopen for binary streams */
/usr/include/X11/Xw32defs.h:#  define O_BINARY    _O_BINARY
/usr/include/ImageMagick-6/magick/studio.h:#if !defined(O_BINARY)
/usr/include/ImageMagick-6/magick/studio.h:#define O_BINARY  0x00
/usr/include/kde_file.h:#ifndef O_BINARY
/usr/include/kde_file.h:#define O_BINARY 0 /* for open() */
/usr/include/jasper/jas_stream.h:#ifndef O_BINARY
/usr/include/jasper/jas_stream.h:#define O_BINARY       0



reply via email to

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