TIOCGWINSZ and busybox

Fischer, Matthew L (SHML - Diagnostics) matt.fischer at hp.com
Sun Mar 11 09:23:17 PDT 2007


> What magic? Can you show 'strace -o resize' output, or better yet,
> show the source of that other resize?

By "magic" I was referring to the ESC sequence reading and writing.  I
guess magic is my term for something when I don't quite understand how
it works ;)

> 
> > > resize's exit code is a result of "set terminal size" ioctl:
> > > 
> > >         ret = ioctl(STDOUT_FILENO, TIOCSWINSZ, &w);
> > >         printf(ESC"8");
> > >         tcsetattr(STDOUT_FILENO, TCSANOW, &old);
> > >         if (ENABLE_FEATURE_RESIZE_PRINT)
> > >                 printf("COLUMNS=%d;LINES=%d;export 
> COLUMNS LINES;\n",
> > >                         w.ws_col, w.ws_row);
> > >         return ret;
> > 
> > So it sounds like we wont be able to use the resize code 
> that comes with
> > busybox, even if we enable it (since it lacks the "regular" resize
> > code's magic guesswork).  It does seem cheesy to change the calls to
> 
> Let us see "regular" resize source (or download URL), maybe
> bbox resize can be improved.
> 
> > more to also call resize too, but other than pulling in the 
> source code,
> > that may be what we do (or just live with 80x24 mode).
> 
> I don't like it. resize does evil hacks in order to get terminal
> size (sends ESC sequences to terminal and reads response).
> These hacks shouldn't propagate into more/less/top etc...
> --
> vda

My version of resize just comes from the Debian source package for
xterm.  I will attach it as a gz file (if that's not okay, I can attach
regular source).
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resize.c.gz
Type: application/x-gzip
Size: 5361 bytes
Desc: resize.c.gz
Url : http://busybox.net/lists/busybox/attachments/20070311/08e70468/attachment.bin 


More information about the busybox mailing list