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
>
> SOMEVAR=xxx
> export SOMEVAR
>
Indeed.
Thanks,
Jürgen
>
>
> 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
> >
>


-- 
Jürgen Lambrecht
R&D Associate
Tel: +32 (0)51 303045    Fax: +32 (0)51 310670
http://www.televic-rail.com
Televic Rail NV - Leo Bekaertlaan 1 - 8870 Izegem - Belgium
Company number 0825.539.581 - RPR Kortrijk

_______________________________________________
LTIB home page: http://ltib.org

Ltib mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/ltib

Reply via email to