* Kris Kennaway <[EMAIL PROTECTED]> [2002-03-31 08:48]:
> On Sun, Mar 24, 2002 at 05:54:36PM -0800, Kris Kennaway wrote:
> > On Sun, Mar 24, 2002 at 06:43:13PM -0700, M. Warner Losh wrote:
> > 
> > > : David O'Brien committed a workaround to the clog port yesterday to
> > > : move the initializer to main() instead of trying to do it statically.
> > > : 
> > > : Is this something which is supposed to work?
> > > 
> > > No.  This isn't something that is guaranteed to work per the
> > > standards, iirc.  The proper fix is to put the initializer in main.
> > 
> > OK.  Someone needs to go and fix those 84 ports then.
> How does one fix this in a library?  I've been moving the
> initialization to main() for applications.

Unfortunately it is not so straight forward.

IMO, the best solution is to initialise to NULL and test for this when
called and change them to stdin and stdout where necessary.
This is a little overhead but the cleanest way IMO.

I heard of the possibility to do things like

 static FILE*fpout=NULL;
 #define fp (fpout?fpout:stdout)

But I never tested this.

I can help you a little bit changing this in the concerning libraries,
if you want, since this seems to be a lot of work.

Department of Computing Science
Federal Armed Forces University Munich

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to