delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/07/11/08:35:00

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 11 Jul 2008 08:34:30 -0400 (EDT)
From: William Sutton <william AT trilug DOT org>
To: cygwin AT cygwin DOT com
Subject: Re: programming API to determine whether in 'Cygwin environment'
In-Reply-To: <20080711075223.GL24644@calimero.vinschen.de>
Message-ID: <alpine.DEB.0.82.0807110832020.28632@pilot.trilug.org>
References: <18395872 DOT post AT talk DOT nabble DOT com> <20080711050615 DOT GA4181 AT ednor DOT casa DOT cgf DOT cx> <45387 DOT 97 DOT 113 DOT 116 DOT 104 DOT 1215754377 DOT squirrel AT webmail DOT efn DOT org> <20080711075223 DOT GL24644 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
X-IsSubscribed: yes
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

All the same, you should probably check to see that whatever variables you 
choose to key off of don't alter the way your program behaves in other 
alternate Windows shells.  A co-worker of mine uses 4NT, which provides 
UNIX command and shell emulation in a native Windows format.  I expect it 
has at least $SHELL and/or $TERM.

FWIW...

William Sutton


On Fri, 11 Jul 2008, Corinna Vinschen wrote:

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

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