Re: fprintf control from Environment variable.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 8, 2012 at 10:22 PM, naveen yadav <yad.naveen@xxxxxxxxx> wrote:
>
> I want to control the print message being sent to stdout and stderr
> using printf(), vprintf() and fprintf() function call for better
> performance.
>
> For this I have added following code in vfprintf() function
>   static int Verbose = 0;
>   if(stream == stdout || stream == stderr)
>   {
>       if (Verbose == 0)
>      Verbose = getenv ("PRINT") ? 1 : 2;
>       if (Verbose == 1)
>      return 0;
>   }

That seems really unwise.  Do this kind of thing in your application,
not in your C library.  If for some reason you truly must do it in
your C library, do it at level of write, not at the level of printf.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux