Re: getenv, putenv



Rainer Weikusat <rweikusat@xxxxxxxxxxx> writes:

floyd@xxxxxxxxxx (Floyd L. Davidson) writes:
Bhawna <bvnbhati@xxxxxxxxx> wrote:
Hi,

I am running a multithreaded application in which I am trying to set
an environment variable using putenv. The string I am using as
argument to putenv was created as

char *str=strdup(<local var>);

1) Don't use an auto variable.

This doesn't matter. The string needs to be alive for as it is still
part of the environment, not some random pointer to it.

2) The symbol "str" violates the implemenation's
name space if you have also included <strings.h>.

You mean string.h.

I don't think so. SUS only reserves any identifier beginning with str,
followed by a lower case letter.

Correct, and the reservation only applies to identifiers with file
scope, so an identifier with block scope can safely be called 'str'.

--
Måns Rullgård
mans@xxxxxxxxx
.



Relevant Pages

  • Re: Implicit object constructor misinterpretation
    ... I think exactly about *identifiers*. ... words identifier foo may identify the most different variables on each ... String literals are sequences of characters flanked by either ... programmer being some toy in hands of "pre-programmed elements". ...
    (comp.lang.javascript)
  • Re: getenv, putenv
    ... Bhawna wrote: ... an environment variable using putenv. ... The string I am using as ...
    (comp.os.linux.development.apps)
  • Re: validation scripting
    ... identifiers based on a text string because the identifier gets plugged ... to this they were using a bit of Java code on a different Web server ... All manual entry ...
    (comp.databases.filemaker)
  • Re: Error executing link.exe??
    ... The name string is reserved for the implementation. ... "All identifiers with external linkage in any of the following ... subclauses (including the future library directions) are always ...
    (comp.lang.c)
  • Re: incrementing variables in javascript
    ... arithmetic addition or string concatenation. ... Better I think to say "Identifiers"; ... Javascript variables has no type, at compile or run-time, but the ... What those operands are is determined the usualy way, ...
    (comp.lang.javascript)