This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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?

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" */
       printf("child  TERM is: %s\n", getenv("TERM"));  /* prints "cygwin" */

-- Unsubscribe info: Problem reports: Documentation: FAQ:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]