delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/12/03/16:22:01

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Message-ID: <41B0D8E4.7050401@smithdomain.com>
Date: Fri, 03 Dec 2004 16:21:40 -0500
From: "B. Scott Smith" <scott AT smithdomain DOT com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: 1.5.12: TERM environment reset to "cygwin" after fork()

Hi all,

Version: CYGWIN_NT-5.0 -- 1.5.12(0.116/4/2) -- i686 unknown unknown Cygwin

I set the TERM environment variable in my application by calling 
setenv(). A subsequent call to getenv("TERM") yields the expected value. 
However, after performing a fork(), the call to getenv("TERM") returns 
"cygwin". This is the case for both the parent and the child.

-- I have found a big clue. If I set the TERM variable in the Windows 
environment prior to running my program (it can be set to anything at 
all), it works as expected.

Any ideas?

Thanks
------
Code snippet:

    setenv("TERM", "ansi", 1);
    /* ... blah, blah, ... */
    printf("TERM is: %s\n", getenv("TERM"));  /* prints "ansi" as expected */
    int i = fork();
    if (i < 0)
        printf("Bad Business...");
    else if ( i > 0 )
        printf("parent TERM is: %s\n", getenv("TERM"));  /* prints "cygwin" */
    else
        printf("child  TERM is: %s\n", getenv("TERM"));  /* prints "cygwin" */




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