[Toybox] Fwd: [New Toy - patch] add ps & watch
Rob Landley
rob at landley.net
Wed Aug 21 09:52:25 PDT 2013
On 08/21/2013 06:47:34 AM, David Seikel wrote:
> 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.
Yeah, less needs to do progressive disclosure, which means a select
loop responding to new lines of output _and_ user keyboard input at the
same time...
> > 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.
That's what I implemented in busybox. :)
Where's your current code for this? Maybe I have time to look at it
now...
Rob
More information about the Toybox
mailing list