delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/03/18/04:52:24

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Wed, 18 Mar 2009 10:51:58 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: _set_fmode?
Message-ID: <20090318095158.GJ9322@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <49C04B2D DOT 2090703 AT cwilson DOT fastmail DOT fm> <20090318094323 DOT GA12824 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20090318094323.GA12824@calimero.vinschen.de>
User-Agent: Mutt/1.5.19 (2009-02-20)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Mar 18 10:43, Corinna Vinschen wrote:
> On Mar 17 21:15, Charles Wilson wrote:
> > Is there a cygwin analogue to the msvc _set_fmode()? That is, a function
> > that sets the default mode of fopen, even if you don't explicitly
> > specify it "rb" or whatever.
> > 
> > Obviously, there's "use binary (or text) mounts".  Less obviously, you
> > can link against /usr/lib/binary.o (or -lbinmode), or text.o (or
> > automode.o or textreadmode.o and the similar .a's).  But I'm looking for
> > an actual function call to replace the following code in libarchive:
> > [...]
> > I'm using binmode.o at present, but I'd prefer to just make a func call
> > at the same place the WIN32-specific code does.  (FWIW, you can't call
> > the w32api _set_fmode() function and expect it to work; the msvc runtime
> > and cygwin maintain different default _fmode variables).
> 
> Cygwin has no such function call except for the per-descriptor function
> setmode (fd, mode).  IMHO using binmode.o is much more elegant.  The
> only other choice you have is this:
> 
>   extern int _fmode;
>   _fmode = O_BINARY;
> 
> _fmode is defined in crt0.o so you can simply access it if you like.
> But anyway, using binmode.o is much more elegant, IMHO.  I don't see
> what speaks against using it.

Btw., it looks like the binmode/textmode documentation in the Cygwin 1.7
user's guide still needs a lot of rework.  Sigh.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019