Stuart Hughes | 8 Oct 2011 12:29

Re: how to get putenv from glibc compiled?

Hi Jürgen,

I'm not sure I understand this question?

putenv is supported by glibc, you'd need to call this library functions
from a C program.

If you want to set en environment variable you should be able to do this
from the she with

SOMEVAR=xxx
export SOMEVAR

Please give some more detail of what you're trying if this does not help.

Regards, Stuart

On 07/10/11 14:48, Lambrecht Jürgen wrote:
> Hello,
> 
> I need 'putenv' (so busybox-dhcpc can pass the ntp server IP to the ntp 
> client) on my target.
> Putenv is in glibc, but in my built, it is not present.
> 
> Does anybody know which options to enable (do I need e.g. libc static 
> libraries CONFIG_PKG_LIBC_WANT_STATIC_LIBS)?
> 
> Kind regards,
> Jürgen
> 
(Continue reading)

Lambrecht Jürgen | 11 Oct 2011 16:22
Favicon

Re: how to get putenv from glibc compiled?

On 10/08/2011 12:29 PM, Stuart Hughes wrote:
>
> Hi Jürgen,
>
> I'm not sure I understand this question?
>
> putenv is supported by glibc, you'd need to call this library functions
> from a C program.
>
Indeed. My C program is the busybox dhcpc (dhcp client).
It puts amongst others the NTP server IP adress in an environment 
variable with 'putenv'.
I first thought it failed because this library function is not present 
as program in linux - I was wrong.

The reason it does not work is explained here: 
http://stackoverflow.com/questions/6981033/why-setenv-does-not-work. (In 
short: "Your program is started */by*/ the shell, so the shell got to 
set its copy of the environment variables, but there is no way for it to 
push a change back to the shell")

Solution: start the ntp client in the same shell as the dhcp client runs 
in. This is made possible in busybox dhcpc by specifying a script in the 
menu config of busybox. In that script, you need to add a line to start 
the ntp client.
(See busybox mailing list)
>
>
> If you want to set en environment variable you should be able to do this
> from the she with
(Continue reading)


Gmane