Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <41ED16DB.3020701@byu.net> Date: Tue, 18 Jan 2005 07:02:03 -0700 From: Eric Blake User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Fwd: Re: more coreutils 5.3.0 issues on cygwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Corinna, why did you change od in coreutils 5.2.1? When I proposed your patch upstream, the maintainers pointed out that 12 lines later in the same method, the code is calling setmode(fd, O_BINARY) for all non-tty input filenames that were just fopen'd. Does cygwin have a working setmode (and if not, does fcntl(fd, F_SETFL, O_BINARY | fcntl(fd, F_GETFL)) work as expected)? -------- Original Message -------- Subject: Re: more 5.3.0 issues on cygwin Date: Tue, 18 Jan 2005 00:09:52 +0100 From: Jim Meyering To: Eric Blake CC: bug-coreutils at gnu dot org Eric Blake wrote: ... > * src/od.c (OPENMODE): New macro. > (open_next_file): Use OPENMODE in fopen call. ... > Index: src/od.c > =================================================================== > RCS file: /cvsroot/coreutils/coreutils/src/od.c,v > retrieving revision 1.152 > diff -u -p -r1.152 od.c > --- src/od.c 28 Sep 2004 01:09:03 -0000 1.152 > +++ src/od.c 17 Jan 2005 13:09:07 -0000 > @@ -70,6 +70,12 @@ typedef unsigned long long int ulonglong > typedef unsigned long int ulonglong_t; > #endif > > +#ifdef O_BINARY > +# define OPENMODE "rb" > +#else > +# define OPENMODE "r" > +#endif > + > enum size_spec > { > NO_SIZE, > @@ -906,7 +912,7 @@ open_next_file (void) > } > else > { > - in_stream = fopen (input_filename, "r"); > + in_stream = fopen (input_filename, OPENMODE); > if (in_stream == NULL) > { > error (0, errno, "%s", input_filename); Why is that needed? od.c already does this: SET_BINARY (fileno (in_stream)); where that macro is defined in system.h: #if O_BINARY # ifndef __DJGPP__ # define setmode _setmode # define fileno(_fp) _fileno (_fp) # endif /* not DJGPP */ # define SET_MODE(_f, _m) setmode (_f, _m) # define SET_BINARY(_f) do {if (!isatty(_f)) setmode (_f, O_BINARY);} while (0) Maybe those #if directives don't work on your system? -- Life is short - so eat dessert first! Eric Blake ebb9 AT byu DOT net -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/