www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-apps/2000/06/25/01:50:46

Mailing-List: contact cygwin-apps-help AT sourceware DOT cygnus DOT com; run by ezmlm
list-help: <mailto:cygwin-apps-help AT sourceware DOT cygnus DOT com>
list-post: <mailto:cygwin-apps AT sourceware DOT cygnus DOT com>
Sender: cygwin-apps-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-apps AT sourceware DOT cygnus DOT com
Message-ID: <005601bfde69$c66fa0c0$f7c723cb@lifelesswks>
From: "Robert Collins" <robert DOT collins AT itdomain DOT com DOT au>
To: <cygwin-apps AT sourceware DOT cygnus DOT com>
References: <20000624234013 DOT A29970 AT cygnus DOT com>
Subject: Re: Pending change to cygwin DLL and binmode/textmode musings
Date: Sun, 25 Jun 2000 15:54:01 +1000
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700

I like the idea of a database of files... that would mean less porting
issues, particularly with programs that act on files in common with other
tools.

Rob


----- Original Message -----
From: "Chris Faylor" <cgf AT cygnus DOT com>
To: <cygwin-apps AT sourceware DOT cygnus DOT com>
Sent: Sunday, June 25, 2000 1:40 PM
Subject: Pending change to cygwin DLL and binmode/textmode musings


> I've been playing around with a change to the cygwin DLL that attempts to
> duplicate functionality that is found in MSVC.
>
> I've created an object called "binmode.o" which, when added to a link line
> will cause any open that does not specify binary or text mode access to
> default to binary access.
>
> This is not 100% the same as Microsoft since you also have to worry about
> text mode and bin mode mounts in Cygwin.  My implementation gives
precedence
> to the (little used?) _fmode variable which has always been around in
Cygwin.
> Setting this variable to O_BINARY used to be the same as CYGWIN=binmode,
> i.e., it didn't affect disk files.  Now it does.  CYGWIN=binmode still
> affects only non-disk files, however.
>
> So, this effectively duplicates MSVC functionality, AFAICT.
>
> Corinna and I were talking about another interface that is more general
> and possibly more useful.
>
> We were talking about developing a "cygwin_set_default_open" function.
> It would work something like this:
>
>   /* Reads of /etc/passwd default to text unless explicitly specified */
>   set_default_open ("/etc/passwd", O_RDONLY | O_TEXT);
>
>   /* Writes of /tmp/bar default to binary unless explicitly specified */
>   set_default_open ("/tmp/bar", O_WRONLY | O_BINARY);
>
>   /* Accesses of any file named foof default to binary unless... */
>   set_default_open ("foof", O_BINARY);
>
> The premise here is that calls to this function can either live in a
> program's "main()" to avoid modifying opens or fopens throughout the
> source.
>
> Alternatively, this could be added to a "premain()" function which would
> be called prior to main().  This would mean that you only have to modify
> a Makefile to link in the file containing the premain() function.
>
> DJ has also suggested that we could maintain a database of files which
> are known to have a certain format.  So, for instance, /etc/passwd
> and /etc/group would be marked in this database as "always text".
>
> Another possibility is to set aside a block of space in each cygwin
> executable that could be filled in with names and modes of files
> that the executable uses.  So, tcsh.exe would be modified, after
> linking, to set .cshrc as "always text".
>
> Anyway, that's what we're thinking of for ways to minimize the
> neverending binmode/textmode problems.
>
> cgf
>

- Raw text -


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