How to read environment variable in Glibc code

Carlos O'Donell carlos@systemhalted.org
Mon Jan 9 13:50:00 GMT 2012


On Mon, Jan 9, 2012 at 7:29 AM, naveen yadav <yad.naveen@gmail.com> wrote:
> Dear All,
>
> I want to disable/enable printf out put to screen by reading
> environment variable similar to LD_DEBUG.
>
> I want to control ./stdio-common/printf.c.
>
> So if in environment variable says disable printf it call
> int
> __printf (const char *format, ...)
> {
> return done;
>
> }
>
> else it execute original code.
>
> Thanks

The libc-help mailing list is the *correct* mailing list for this
discussion, I'm removing the other mailing lists.

The easiest way to achieve what you want is to provide your own
version of printf in your program.

This custom version of printf can be implemented in any way you want
but works only for your program.

If you want to stop output to stdio for precompiled programs then you
need to rebuild libc with the appropriate change to printf.c.

What problem are you having?

Cheers,
Carlos.



More information about the Libc-help mailing list