[Toybox] Fwd: [New Toy - patch] add ps & watch

Rob Landley rob at landley.net
Tue Aug 20 13:55:24 PDT 2013


On 08/20/2013 04:46:20 AM, Ashwini Sharma wrote:
> Hi Rob,
> 
>   Attached are the patches for _watch_  and _ps_ command.
> 
> Sent _ps_ again, just in case you lost the last one. This one also  
> have a
> copyright update.

I planned to do watch.c after doing less.c because both have the  
similar "printing a chunk of a larger screen" logic. If your command  
output produces too many lines, it shouldn't scroll off, but given that  
it can wrap around to produce more lines, you can't just count lines.  
For example:

   watch 'python -c "print 100*\"abcdefghijklmnopqrstuvwxyz\""'

This version just scrolls off. It doesn't capture the output and make  
an attempt to format it. But toybox needs that logic for less, more,  
vi, editing command line history...

I also hadn't figured out what I wanted to do about:

   watch "while true; do echo hello; sleep 1; done"

Should it produce incremental output like "less" would, and kill/reset  
the child periodically? Or do what the gnu/dammit version does and  
block indefinitely with a gap between runs?

Rob


More information about the Toybox mailing list