X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Fri, 11 Jul 2008 09:52:23 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: programming API to determine whether in 'Cygwin environment'
Message-ID: <20080711075223.GL24644@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <18395872.post@talk.nabble.com> <20080711050615.GA4181@ednor.casa.cgf.cx> <45387.97.113.116.104.1215754377.squirrel@webmail.efn.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <45387.97.113.116.104.1215754377.squirrel@webmail.efn.org>
User-Agent: Mutt/1.5.16 (2007-06-09)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Jul 10 22:32, Yitzchak Scott-Thoennes wrote:
> On Thu, July 10, 2008 10:06 pm, Christopher Faylor wrote:
> > On Thu, Jul 10, 2008 at 08:49:06PM -0700, Tony Last wrote:
> >> My console program is built for native Windows (thus does not reply on
> >> cygwin1.dll).
> >>
> >> So I'm looking for a boolean method which will allow a program to tell
> >> whether it was run from within a Cygwin shell.
> >
> > A PATH containing colons which weren't preceded by just a single
> > alphabetic character would be a clue but it wouldn't be foolproof.  A HOME
> > environment variable with no colons and forward slashes would be another
> > clue.  I don't think there is a foolproof test, though.
> 
> Both HOME and PATH are translated by the time the non-cygwin program
> sees them, though??

$TERM would be set.  That's very unlikely when started from cmd.
$SHELL would be a hint, too.


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/

