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

David Seikel onefang at gmail.com
Wed Aug 21 04:47:34 PDT 2013


On Wed, 21 Aug 2013 02:11:39 -0500 Rob Landley <rob at landley.net> wrote:

> On 08/20/2013 11:15:42 PM, David Seikel wrote:
> > On Tue, 20 Aug 2013 15:55:24 -0500 Rob Landley <rob at landley.net>  
> > wrote:
> > 
> > > 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've been thinking about what you said before about my large
> > editor and
> > screen handling blob.  I think I have found a way to at least make
> > one or two much smaller blobs to help ease it into toybox.  Finding
> > the time to get to it is a problem we are all too familiar with.
> > I'll get there, I want to actually use it myself.
> 
> I note that busybox gets this wrong (their "watch" shows all output  
> each time, scrolling the screen at length for "watch ls -lR /"), so  
> it's an easy mistake to make. But I want to be _better_ than busybox.

Busybox's "less" also just dumps it all in one go if I remember.

> Also, this is one of them "damn fiddly" bits whith asynchronous
> ascii probing of screen size as part of interactive input, responding
> to dynamic window resizing (keeping in mind that sigwinch won't
> propogate over a serial port), fixing it so the shell notices when
> it's not starting at the left edge (in bash "echo -n walrus" screws
> up editing of the following line; at one point busybox ash got that
> right because I complained), 

That's the first thing I want to do as a single smaller patch, sorting
out the various terminal size fiddly bits.  I had noticed when I was
looking at it last time that I've not completely sorted that out
anyway, but I was close.

> that fun bit about collating escape sequence input while also
> allowing escape by itself to put vi into command mode (I used 1/3 of
> a second timeout)...

That bit I got solved, also with a time out.  Seems the only way.

> It's fiddly, but once we've got it right once, the code should apply
> to a lot of situations.
> 
> Rob

-- 
A big old stinking pile of genius that no one wants
coz there are too many silver coated monkeys in the world.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20130821/77202f1f/attachment-0002.sig>


More information about the Toybox mailing list