| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-Spam-Check-By: | sourceware.org |
| Date: | Fri, 11 Jul 2008 01:06:15 -0400 |
| From: | Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: programming API to determine whether in "Cygwin environment" |
| Message-ID: | <20080711050615.GA4181@ednor.casa.cgf.cx> |
| Reply-To: | cygwin AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| References: | <18395872 DOT post AT talk DOT nabble DOT com> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <18395872.post@talk.nabble.com> |
| User-Agent: | Mutt/1.5.16 (2007-06-09) |
| 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 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). However, people may want to use it in a Cygwin environment and >if they do I want it to behave in a suitably "Unixy" way. The obvious >example is that when it prints out a pathname (which happens a lot) a Cygwin >user would prefer to see it in Cygwin style, including forward slashes. > >So I'm looking for a boolean method which will allow a program to tell >whether it was run from within a Cygwin shell. An environment variable would >be fine as long as it's standard. In fact I see a number of env vars which >would enable an educated guess but am wondering if there's a defined >standard and safe way. 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. cgf -- 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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |