From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b587faeee5fad895 X-Google-Attributes: gid103376,public From: "Nick Roberts" Subject: Re: ada/c if - putenv? Date: 2000/03/14 Message-ID: <38ce8e41@eeyore.callnetuk.com>#1/1 X-Deja-AN: 597454005 References: <38C53194.EE4BAC3E@mindspring.com> X-Original-NNTP-Posting-Host: da129d215.dialup.callnetuk.com X-Trace: 14 Mar 2000 19:08:49 GMT, da129d215.dialup.callnetuk.com X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: comp.lang.ada X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Date: 2000-03-14T00:00:00+00:00 List-Id: I think I may have come across this one before. I believe there are some well-known UNIXen which implement putenv contrary to the manual, in that they only add a pointer to the argument to the environment, rather than actually allocating a new string and copying the characters in (aaaargh!). The result is, of course, that deallocating the argument afterwards knackers the environment (causing crashes, spurious behaviour, or whatever). Of course, doesn't this one case just perfectly exemplify the true awfulness of both UNIX (and its derivatives) and C? -- Nick Roberts http://www.adapower.com/lab/adaos "Al Johnston" wrote in message news:38C53194.EE4BAC3E@mindspring.com... > Will someone please explain why the following program does not > work?. If I set the env manually and remove the call to putenv > from the test case, the call to getenv works okay... but when > I let the test code call putenv, not only does the getenv call > not return the value given it by the putenv call, but it does > not even get the old (manually set) value...