delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/02/06/11:28:21

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-Id: <5.2.0.9.2.20030206081918.01d9cee8@pop3.cris.com>
X-Sender: rrschulz AT pop3 DOT cris DOT com
Date: Thu, 06 Feb 2003 08:27:30 -0800
To: cygwin AT cygwin DOT com
From: Randall R Schulz <rrschulz AT cris DOT com>
Subject: Re: Detecting text type in a shell script
In-Reply-To: <Pine.GSO.4.53.0302061104010.1132@arachnion.cs.Virginia.EDU
>
References: <00e101c2cdf8$79490fd0$78d96f83 AT pomello>
<Pine DOT GSO DOT 4 DOT 53 DOT 0302061048490 DOT 1087 AT arachnion DOT cs DOT Virginia DOT EDU>
<00e101c2cdf8$79490fd0$78d96f83 AT pomello>
Mime-Version: 1.0

Nicolas,

At 08:13 2003-02-06, Nicolas Christin wrote:
>On Thu, 6 Feb 2003, Max Bowsher wrote:
>
> > Nicolas Christin wrote:
> > >
> > > How can I detect what text type was chosen at install time? (So that I
> > > can appropriately set/unset my cygwin-unix-type variable.)
> >
> > man mount
>
>Max, thanks.
>
>OK... I had actually checked that, but it didn't come to me as
>straightforward how to use it for my particular problem. Can I just
>assume that if I don't see any "textmode" field in the mount table, then
>everything is fine?

That would be a conservative approach. Clearly if there are no text 
mode mounts, text mode will not be in effect.

But note that you must also check the CYGWIN environment variable, 
though, for the "binmod" / "nobinmode" option. Refer to 
<http://cygwin.com/cygwin-ug-net/using-cygwinenv.html> for details.

If you want to be more refined about the determination you make in your 
script, you'll have to analyze the mount table as reported by the 
"mount" command and emulate Cygwin's algorithm for determining which 
mount point is used to access a given file (name).


>More specifically, does something of the kind:
>
>#!/bin/sh
># test we're in binmode
>
>mount | grep textmode >/dev/null 2>&1
>
>if [ "$?" -eq "0" ]; then
>         # found text modes - probably bad
>         bail();
>else
>         proceed();
>fi;
>
>would do? (I don't have a DOS-type installed Cygwin available at the
>moment, so I'm doing this blind and can't test it...)
>
>Thanks again,
>--
>Nicolas


Randall Schulz 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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