[Patch] Make getenv() functional before the environment is initialized

Christopher Faylor cgf-no-personal-reply-please@cygwin.com
Mon Apr 24 16:36:00 GMT 2006


On Mon, Apr 24, 2006 at 12:16:34PM -0400, Pierre A. Humblet wrote:
>----- Original Message ----- 
>From: "Christopher Faylor"
>To: <cygwin-patches@cygwin.com>
>Sent: Friday, April 21, 2006 5:39 PM
>Subject: Re: [Patch] Make getenv() functional before the environment is 
>initialized
>
>
>>I just talked to Corinna about this on IRC and neither of us really
>>cares enough about this to merit a long discussion so I've just checked
>>in a variation of the cmalloc patch.  The only change that I made was to
>>define a HEAP_2_STR value so that the HEAP_1_MAX usage is confined to
>>cygheap.cc where I'd intended it.
>
>Thanks a lot, Chris & Corinna.
>
>Now that I am trying it, it doesn't work anymore when launched from Cygwin.
>
>I am starting to wonder if the current
>*ptr[len] == '='
>is equivalent to the former
>*(*ptr + s) == '='
>when s = len and ptr is a char **

If it didn't work, I'd think that g++ would complain.  However, this
isn't really something that needs much discussion since it is easy to
test.

Create the below program and name it 'foo'.  Then, make sure that the
current directory is in your path, and type 'foo'.

I get a "it works" when I do this.

cgf

#include <stdio.h>

int
main (int argc, char **argv)
{
  if (*argv[0] == 'f')
    puts ("it works");
}



More information about the Cygwin-patches mailing list