This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: How to read environment variable in Glibc code
On Tue, 10 Jan 2012 10:09:22 +0530
naveen yadav <yad.naveen@gmail.com> wrote:
> Thanks a lot for your valuable input. I want to control printf from
> environment variable.
> If I set Environment variable 1 it enable print to screen if i put
> Environment variable to 0 it disable to screen.
>
> Actual I have already prebuild software, I want to control its o/p
> using glibc and Environment variable.
>
>
> Thanks.
>
And why exactly must this be done with an environment variable?
Whats wrong with
1. myProgram > /dev/null
2. myProgram > myFile
3. myProgram
If you don't like to redirect the output, then I think you need to LD_PRELOAD a library which gives you the behaviour you need.
Cheers
Andreas