Re: puts doesn't show up in multilog

richard lucassen <[email protected]> Thu, 13 Aug 2009 18:01:51 +0200
Newsgroups gmane.comp.djb.syslog
Organization XAQ Systems
Message-ID <[email protected]>
On Thu, 13 Aug 2009 22:00:15 +0930
Daryl Tester <[email protected]> wrote:

> (* Reply-to munged *)
> 
> > I've got a small C program that writes a string to sdtout.
> > 
> > When starting ./run by hand, the message shows up. When running
> > supervised, nothing is logged. I added an "echo -e "starting
> > program" to the run file and this messages is logged. So the
> > multilog is reading stdout/stderr. Anyone an idea of what is
> > happening?
> 
> Not flushing the output?  The stdio library might be recognising that
> you're not writing to a tty and performing "excessive buffering".  Try
> an "fflush(stdout)" after your puts().  If that fixes it, then you can
> alter the buffering semantics with of that stream with setvbuf() or
> equivalent.

The fflush(stdout) does the job :)

Ok, unfortunately I'm not a programmer, but searching a bit the web I
think this would be the line I need:

setvbuf ( stdout , NULL , _IONBF , 0 );

It works, but is the line correct?

R.

-- 
___________________________________________________________________
It is better to remain silent and be thought a fool, than to speak
aloud and remove all doubt.

+------------------------------------------------------------------+
| Richard Lucassen, Utrecht                                        |
| Public key and email address:                                    |
| http://www.lucassen.org/mail-pubkey.html                         |
+------------------------------------------------------------------+