public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* programming API to determine whether in "Cygwin environment"
@ 2008-07-11  3:49 Tony Last
  2008-07-11  5:06 ` Christopher Faylor
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Tony Last @ 2008-07-11  3:49 UTC (permalink / raw)
  To: cygwin


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.

TIA
-- 
View this message in context: http://www.nabble.com/programming-API-to-determine-whether-in-%22Cygwin-environment%22-tp18395872p18395872.html
Sent from the Cygwin list mailing list archive at Nabble.com.


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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: programming API to determine whether in "Cygwin environment"
  2008-07-11  3:49 programming API to determine whether in "Cygwin environment" Tony Last
@ 2008-07-11  5:06 ` Christopher Faylor
  2008-07-11  5:33   ` programming API to determine whether in 'Cygwin environment' Yitzchak Scott-Thoennes
  2008-07-11 15:24 ` programming API to determine whether in "Cygwin environment" Tony Last
  2008-07-11 15:36 ` Karr, David
  2 siblings, 1 reply; 20+ messages in thread
From: Christopher Faylor @ 2008-07-11  5:06 UTC (permalink / raw)
  To: cygwin

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/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: programming API to determine whether in 'Cygwin environment'
  2008-07-11  5:06 ` Christopher Faylor
@ 2008-07-11  5:33   ` Yitzchak Scott-Thoennes
  2008-07-11  7:51     ` Corinna Vinschen
  2008-07-11 12:59     ` Christopher Faylor
  0 siblings, 2 replies; 20+ messages in thread
From: Yitzchak Scott-Thoennes @ 2008-07-11  5:33 UTC (permalink / raw)
  To: cygwin

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



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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: programming API to determine whether in 'Cygwin environment'
  2008-07-11  5:33   ` programming API to determine whether in 'Cygwin environment' Yitzchak Scott-Thoennes
@ 2008-07-11  7:51     ` Corinna Vinschen
  2008-07-11  9:22       ` daemon opens blank dos windows for its subprocess Pierre-Philipp Braun
  2008-07-11 12:34       ` programming API to determine whether in 'Cygwin environment' William Sutton
  2008-07-11 12:59     ` Christopher Faylor
  1 sibling, 2 replies; 20+ messages in thread
From: Corinna Vinschen @ 2008-07-11  7:51 UTC (permalink / raw)
  To: cygwin

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/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* daemon opens blank dos windows for its subprocess
  2008-07-11  7:51     ` Corinna Vinschen
@ 2008-07-11  9:22       ` Pierre-Philipp Braun
  2008-07-11 12:17         ` Jason Tishler
  2008-07-12 12:40         ` Thorsten Kampe
  2008-07-11 12:34       ` programming API to determine whether in 'Cygwin environment' William Sutton
  1 sibling, 2 replies; 20+ messages in thread
From: Pierre-Philipp Braun @ 2008-07-11  9:22 UTC (permalink / raw)
  To: cygwin

Hi,

I'm using cygwin to filter my emails with fetchmail and procmail.
Problem is, when fetchmail launches procmail (mda "/usr/bin/procmail -f
- -m $HOME/.procmailrc.file"), it quickly opens and closes freacking
(blank) dos windows !  How to avoid that ?

Thanks
-Pierre-Philipp

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: daemon opens blank dos windows for its subprocess
  2008-07-11  9:22       ` daemon opens blank dos windows for its subprocess Pierre-Philipp Braun
@ 2008-07-11 12:17         ` Jason Tishler
  2008-07-11 13:38           ` Pierre-Philipp Braun
  2008-07-12 12:40         ` Thorsten Kampe
  1 sibling, 1 reply; 20+ messages in thread
From: Jason Tishler @ 2008-07-11 12:17 UTC (permalink / raw)
  To: cygwin

Pierre-Philipp,

On Fri, Jul 11, 2008 at 11:21:53AM +0200, Pierre-Philipp Braun wrote:
> I'm using cygwin to filter my emails with fetchmail and procmail.
> Problem is, when fetchmail launches procmail (mda "/usr/bin/procmail
> -f - -m $HOME/.procmailrc.file"), it quickly opens and closes
> freacking (blank) dos windows !  How to avoid that ?

You can workaround the issue by running fetchmail as a service.  See the
following for the details:

    /usr/share/doc/Cygwin/fetchmail-6.3.8.README

Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: programming API to determine whether in 'Cygwin environment'
  2008-07-11  7:51     ` Corinna Vinschen
  2008-07-11  9:22       ` daemon opens blank dos windows for its subprocess Pierre-Philipp Braun
@ 2008-07-11 12:34       ` William Sutton
  2008-07-11 13:06         ` Christopher Faylor
  2008-07-12 12:36         ` Thorsten Kampe
  1 sibling, 2 replies; 20+ messages in thread
From: William Sutton @ 2008-07-11 12:34 UTC (permalink / raw)
  To: cygwin

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/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: programming API to determine whether in 'Cygwin environment'
  2008-07-11  5:33   ` programming API to determine whether in 'Cygwin environment' Yitzchak Scott-Thoennes
  2008-07-11  7:51     ` Corinna Vinschen
@ 2008-07-11 12:59     ` Christopher Faylor
  1 sibling, 0 replies; 20+ messages in thread
From: Christopher Faylor @ 2008-07-11 12:59 UTC (permalink / raw)
  To: cygwin

On Thu, Jul 10, 2008 at 10:32:57PM -0700, 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??

Oops.  Yes.  What was I thinking?  Sorry for the misinformation and thanks
for the correction.

Nevermind.

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/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: programming API to determine whether in 'Cygwin environment'
  2008-07-11 12:34       ` programming API to determine whether in 'Cygwin environment' William Sutton
@ 2008-07-11 13:06         ` Christopher Faylor
  2008-07-12 12:36         ` Thorsten Kampe
  1 sibling, 0 replies; 20+ messages in thread
From: Christopher Faylor @ 2008-07-11 13:06 UTC (permalink / raw)
  To: cygwin

On Fri, Jul 11, 2008 at 08:34:30AM -0400, William Sutton wrote:
>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.

I've been using 4NT for years.  I love it.

My version of 4NT doesn't set SHELL or TERM.

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/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: daemon opens blank dos windows for its subprocess
  2008-07-11 12:17         ` Jason Tishler
@ 2008-07-11 13:38           ` Pierre-Philipp Braun
  2008-07-11 20:14             ` Jason Tishler
  0 siblings, 1 reply; 20+ messages in thread
From: Pierre-Philipp Braun @ 2008-07-11 13:38 UTC (permalink / raw)
  To: cygwin

Fetchmail now runs as a service.  It's solved.
Just wondering : what happends with its stderr if there are some errors?
(with or without the --nodetach)

Besides, what client are you using ?  I used Pine a lot but I prefer
graphical clients at the end.  So I'm using xinetd/uw-imapd.

Regards
-Pierre-Philipp

Quoting Jason Tishler (11/07/2008 14:14),
> Pierre-Philipp,
> 
> On Fri, Jul 11, 2008 at 11:21:53AM +0200, Pierre-Philipp Braun wrote:
>> I'm using cygwin to filter my emails with fetchmail and procmail.
>> Problem is, when fetchmail launches procmail (mda "/usr/bin/procmail
>> -f - -m $HOME/.procmailrc.file"), it quickly opens and closes
>> freacking (blank) dos windows !  How to avoid that ?
> 
> You can workaround the issue by running fetchmail as a service.  See the
> following for the details:
> 
>     /usr/share/doc/Cygwin/fetchmail-6.3.8.README
> 
> Jason
> 

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: programming API to determine whether in "Cygwin environment"
  2008-07-11  3:49 programming API to determine whether in "Cygwin environment" Tony Last
  2008-07-11  5:06 ` Christopher Faylor
@ 2008-07-11 15:24 ` Tony Last
  2008-07-11 15:38   ` Dave Korn
  2008-07-11 15:36 ` Karr, David
  2 siblings, 1 reply; 20+ messages in thread
From: Tony Last @ 2008-07-11 15:24 UTC (permalink / raw)
  To: cygwin


What about the following EVs which a quick "env" shows: "MAKE_MODE", "SHLVL",
and "!C:"? I assume SHLVL is an artifact of bash and only present if bash is
an ancestor? I have no idea who sets MAKE_MODE. And "!C:" is a very strange
one but presumably is exported by Cygwin?
-- 
View this message in context: http://www.nabble.com/programming-API-to-determine-whether-in-%22Cygwin-environment%22-tp18395872p18406378.html
Sent from the Cygwin list mailing list archive at Nabble.com.


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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: programming API to determine whether in "Cygwin environment"
  2008-07-11  3:49 programming API to determine whether in "Cygwin environment" Tony Last
  2008-07-11  5:06 ` Christopher Faylor
  2008-07-11 15:24 ` programming API to determine whether in "Cygwin environment" Tony Last
@ 2008-07-11 15:36 ` Karr, David
  2008-07-11 15:58   ` Dave Korn
  2008-07-11 16:00   ` Christopher Faylor
  2 siblings, 2 replies; 20+ messages in thread
From: Karr, David @ 2008-07-11 15:36 UTC (permalink / raw)
  To: Tony Last, cygwin

The "ant" shell script checks to see if "`uname`" contains the string
"CYGWIN". 

> -----Original Message-----
> From: cygwin-owner@cygwin.com 
> [mailto:cygwin-owner@cygwin.com] On Behalf Of Tony Last
> Sent: Thursday, July 10, 2008 8:49 PM
> To: cygwin@cygwin.com
> Subject: programming API to determine whether in "Cygwin environment"
> 
> 
> 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.
> 
> TIA
> --
> View this message in context: 
> http://www.nabble.com/programming-API-to-determine-whether-in-
%22Cygwin-environment%22-tp18395872p18395872.html
> Sent from the Cygwin list mailing list archive at Nabble.com.
> 
> 
> --
> 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/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: programming API to determine whether in "Cygwin environment"
  2008-07-11 15:24 ` programming API to determine whether in "Cygwin environment" Tony Last
@ 2008-07-11 15:38   ` Dave Korn
  2008-07-11 15:45     ` Larry Hall (Cygwin)
  0 siblings, 1 reply; 20+ messages in thread
From: Dave Korn @ 2008-07-11 15:38 UTC (permalink / raw)
  To: cygwin

Tony Last wrote on 11 July 2008 16:24:

>  I have no idea who sets MAKE_MODE. 

  Probably you did!  It used to mean something to make a long time ago, but
was always a user-controlled variable even then.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: programming API to determine whether in "Cygwin environment"
  2008-07-11 15:38   ` Dave Korn
@ 2008-07-11 15:45     ` Larry Hall (Cygwin)
  2008-07-11 15:54       ` Tony Last
  0 siblings, 1 reply; 20+ messages in thread
From: Larry Hall (Cygwin) @ 2008-07-11 15:45 UTC (permalink / raw)
  To: cygwin

Dave Korn wrote:
> Tony Last wrote on 11 July 2008 16:24:
> 
>>  I have no idea who sets MAKE_MODE. 
> 
>   Probably you did!  It used to mean something to make a long time ago, but
> was always a user-controlled variable even then.


Or it's possible he (and others) just picked it up from
'/etc/defaults/etc/profile' where it is set.


-- 
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: programming API to determine whether in "Cygwin environment"
  2008-07-11 15:45     ` Larry Hall (Cygwin)
@ 2008-07-11 15:54       ` Tony Last
  0 siblings, 0 replies; 20+ messages in thread
From: Tony Last @ 2008-07-11 15:54 UTC (permalink / raw)
  To: cygwin


Dave Korn wrote:
> Tony Last wrote on 11 July 2008 16:24:
> 
>>  I have no idea who sets MAKE_MODE. 
> 
>   Probably you did!  It used to mean something to make a long time ago,
> but
> was always a user-controlled variable even then.


Or it's possible he (and others) just picked it up from
'/etc/defaults/etc/profile' where it is set.

Yes, that.
-- 
View this message in context: http://www.nabble.com/programming-API-to-determine-whether-in-%22Cygwin-environment%22-tp18395872p18406976.html
Sent from the Cygwin list mailing list archive at Nabble.com.


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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: programming API to determine whether in "Cygwin environment"
  2008-07-11 15:36 ` Karr, David
@ 2008-07-11 15:58   ` Dave Korn
  2008-07-11 16:00   ` Christopher Faylor
  1 sibling, 0 replies; 20+ messages in thread
From: Dave Korn @ 2008-07-11 15:58 UTC (permalink / raw)
  To: cygwin

Karr, David wrote on 11 July 2008 16:34:

> The "ant" shell script checks to see if "`uname`" contains the string
> "CYGWIN".

  Won't help here:

>> -----Original Message-----
>> From: cygwin-owner On Behalf Of Tony Last
>> Sent: Thursday, July 10, 2008 8:49 PM

>> So I'm looking for a boolean method which will allow a
>> program to tell whether it was run from within a Cygwin
>> shell. 

  Invoking uname will return the same output regardless if you launch it
from bash or cmd.exe, so can't be used to tell the two apart.


  Frankly the best method is to use standard win32 functions to identify
your parent process, then either a) check if the name contains the substring
"sh.exe", or b) check if cygwin1.dll is mapped into the parent's address
space, depending on how robust against really unlikely false positives you
wanted to be.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: programming API to determine whether in "Cygwin environment"
  2008-07-11 15:36 ` Karr, David
  2008-07-11 15:58   ` Dave Korn
@ 2008-07-11 16:00   ` Christopher Faylor
  1 sibling, 0 replies; 20+ messages in thread
From: Christopher Faylor @ 2008-07-11 16:00 UTC (permalink / raw)
  To: cygwin

On Fri, Jul 11, 2008 at 08:34:17AM -0700, Karr, David wrote:
>The "ant" shell script checks to see if "`uname`" contains the string
>"CYGWIN". 

That just means that you have a Cygwin uname in your path.  It doesn't
mean you're necessarily running in a Cygwin "environment".  I thought the
intent was to print c:\foo at the CMD prompt and /cygdrive/c/foo when
running under some shell.

So, really the best test for that is the SHELL environment variable
containing just '/' and no '\' or ':'.  The Cygwin DLL doesn't mess with
that environment variable.

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/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: daemon opens blank dos windows for its subprocess
  2008-07-11 13:38           ` Pierre-Philipp Braun
@ 2008-07-11 20:14             ` Jason Tishler
  0 siblings, 0 replies; 20+ messages in thread
From: Jason Tishler @ 2008-07-11 20:14 UTC (permalink / raw)
  To: cygwin

Pierre-Philipp,

On Fri, Jul 11, 2008 at 03:37:59PM +0200, Pierre-Philipp Braun wrote:
> Fetchmail now runs as a service.  It's solved.
> Just wondering : what happends with its stderr if there are some
> errors?  (with or without the --nodetach)

fetchmail can be configured to log to a file.  For example:

    set logfile /var/log/fetchmail.log

See the fetchmail man page for more details.

> Besides, what client are you using ?  I used Pine a lot but I prefer
> graphical clients at the end.  So I'm using xinetd/uw-imapd.

I use mutt.

Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: programming API to determine whether in 'Cygwin environment'
  2008-07-11 12:34       ` programming API to determine whether in 'Cygwin environment' William Sutton
  2008-07-11 13:06         ` Christopher Faylor
@ 2008-07-12 12:36         ` Thorsten Kampe
  1 sibling, 0 replies; 20+ messages in thread
From: Thorsten Kampe @ 2008-07-12 12:36 UTC (permalink / raw)
  To: cygwin

* William Sutton (Fri, 11 Jul 2008 08:34:30 -0400 (EDT))
> 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.

4NT is now called TakeCommand and the shell "Take Command Console" 
(TCC). It does not set these variables.

As as sidenote TCC/LE is now free as in free of charge.

Thorsten


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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: daemon opens blank dos windows for its subprocess
  2008-07-11  9:22       ` daemon opens blank dos windows for its subprocess Pierre-Philipp Braun
  2008-07-11 12:17         ` Jason Tishler
@ 2008-07-12 12:40         ` Thorsten Kampe
  1 sibling, 0 replies; 20+ messages in thread
From: Thorsten Kampe @ 2008-07-12 12:40 UTC (permalink / raw)
  To: cygwin

* Pierre-Philipp Braun (Fri, 11 Jul 2008 11:21:53 +0200)
> 
> I'm using cygwin to filter my emails with fetchmail and procmail.
> Problem is, when fetchmail launches procmail (mda "/usr/bin/procmail -f
> - -m $HOME/.procmailrc.file"), it quickly opens and closes freacking
> (blank) dos windows !  How to avoid that ?

Please don't highjack threads. If you ask a new question create a new 
email instead of replying. That's basic knowledge and courtesy.

Thorsten


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

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2008-07-12 12:40 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-11  3:49 programming API to determine whether in "Cygwin environment" Tony Last
2008-07-11  5:06 ` Christopher Faylor
2008-07-11  5:33   ` programming API to determine whether in 'Cygwin environment' Yitzchak Scott-Thoennes
2008-07-11  7:51     ` Corinna Vinschen
2008-07-11  9:22       ` daemon opens blank dos windows for its subprocess Pierre-Philipp Braun
2008-07-11 12:17         ` Jason Tishler
2008-07-11 13:38           ` Pierre-Philipp Braun
2008-07-11 20:14             ` Jason Tishler
2008-07-12 12:40         ` Thorsten Kampe
2008-07-11 12:34       ` programming API to determine whether in 'Cygwin environment' William Sutton
2008-07-11 13:06         ` Christopher Faylor
2008-07-12 12:36         ` Thorsten Kampe
2008-07-11 12:59     ` Christopher Faylor
2008-07-11 15:24 ` programming API to determine whether in "Cygwin environment" Tony Last
2008-07-11 15:38   ` Dave Korn
2008-07-11 15:45     ` Larry Hall (Cygwin)
2008-07-11 15:54       ` Tony Last
2008-07-11 15:36 ` Karr, David
2008-07-11 15:58   ` Dave Korn
2008-07-11 16:00   ` Christopher Faylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).