On 06/16/2011 05:20 PM, Andrew Tannenbaum wrote:
> I was trying to use the Xenomai RT-Socket-CAN rtcanrecv in a Tcl/Tk
> script GUI wrapper.
> 
> rtcanrecv uses printf to stdout, and it line-buffers when attached to a
> tty, but it uses larger buffers (so it is unusable) when run from a
> script with no tty.
> 
> Tcl does stdio with pipes rather than ptys (that is, Tcl thinks it has
> no tty for stdio).  I think both bash and perl use ptys (and so don't
> have this problem).  I haven't done a more thorough survey, but that's
> not the point.
> 
> I think it would be nice to modify rtcanrecv so it can write stdout in
> line-buffered mode.  If you think this is a good idea, please either set
> line buffering with
> 
>     setvbuf(stdout, NULL, _IOLBF, 0);
> 
> at the top of src/utils/can/rtcanrecv.c:rt_task() or
> 
>     fflush(stdout);
> 
> after the printf("\n") at the bottom of rt_task(), or you could add a
> command line getopt option for line-buffering that would do one of the
> above.

I would prefer the latter, patches are welcome. Be aware that using
printf will switch to secondary mode which should be avoided if
real-time is required.

Wolfgang.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to