Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <013901c0759c$65933cb0$0200a8c0@lifelesswks> From: "Robert Collins" To: References: <011701c07598$ddd97a30$0200a8c0 AT lifelesswks> <20010103101518 DOT C32356 AT redhat DOT com> <012301c07599$a78cc300$0200a8c0 AT lifelesswks> <20010103103105 DOT A439 AT redhat DOT com> Subject: Re: new function suggestion fsetmode Date: Thu, 4 Jan 2001 02:46:53 +1100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Where setmode is introduced, I'd simply add. "Use the standard fileno(fp) call to get the fd from the result of a fopen() call." I do recall fileno after you reminded me... just needed a memory jog. The binmode/textmode & automode could be useful & I don't think they are mentioned on that particular page either. While they were discussed on the list a lot, new porters may be ignorant of them - Perhaps they could be mentioned on the programming page? Unfortunately for me the work I am doing is the last little bits to make Squid behave properly on text mounts with cygwin - So I can give you a test tarball for distribution. Rob ----- Original Message ----- From: "Christopher Faylor" To: Sent: Thursday, January 04, 2001 2:31 AM Subject: Re: new function suggestion fsetmode > On Thu, Jan 04, 2001 at 02:27:15AM +1100, Robert Collins wrote: > >oops. Thanks for the tip. > > > >Can I suggest a reference to that on > >http://www.cygwin.com/cygwin-ug-net/using-textbinary.html > > fileno is a pretty standard part of any UNIX API, but if you'd like to > suggest new wording I'd be happy to include it. There are also new > 'binmode.o', 'textmode.o', and 'automode.o' object files available for > changing the defaults on a per-binary basis. automode.o (probably > misnamed) changes the default to 'read text'/'write binary'. > > cgf > > >Rob > >----- Original Message ----- > >From: "Christopher Faylor" > >To: > >Sent: Thursday, January 04, 2001 2:15 AM > >Subject: Re: new function suggestion fsetmode > > > > > >> On Thu, Jan 04, 2001 at 02:21:36AM +1100, Robert Collins wrote: > >> >Hi, > >> > I'd like to suggest a function for working on FILE* handles > >> > > >> >int fsetmode(FILE* fhandle, int mode) > >> >{ > >> > if (fhandle) > >> > return setmode(fhandle->_file, mode); > >> > else > >> > return EOF; > >> >} > >> > > >> >I wasn't sure where in cygwin to place it... so I'll leave that up to > >> >the core group. I ran across a whole bunch of fopen calls recently > >> >that needed to be forced into text mode.. this is how I've done it. > >> > > >> >Maybe bad things happen doing this? I assume not. But as the function > >> >needs to look into the FILE * struct's privates, I figure it should be > >> >part of cygwin itself. > >> > >> I think it is preferable to just use 'setmode' and the 'fileno(fp)' interface. > >> fileno() is the accepted way for looking at the internal "_file" part of > >> an fd structure. > >> > >> cgf > >> > >> -- > >> Want to unsubscribe from this list? > >> Check out: http://cygwin.com/ml/#unsubscribe-simple > >> > >> > > > > > >-- > >Want to unsubscribe from this list? > >Check out: http://cygwin.com/ml/#unsubscribe-simple > > -- > cgf AT cygnus DOT com Red Hat, Inc. > http://sources.redhat.com/ http://www.redhat.com/ > > -- > Want to unsubscribe from this list? > Check out: http://cygwin.com/ml/#unsubscribe-simple > > -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple