svn commit: trunk/busybox/console-tools

Denis Vlasenko vda.linux at googlemail.com
Tue Mar 13 14:06:52 PDT 2007


On Tuesday 13 March 2007 09:35, Bernhard Fischer wrote:
> On Mon, Mar 12, 2007 at 04:41:07PM -0700, vda at busybox.net wrote:
> >Author: vda
> >Date: 2007-03-12 16:41:07 -0700 (Mon, 12 Mar 2007)
> >New Revision: 18080
> >
> >Log:
> >resize: make it usable in in backticks; have a timeout (if display
> >doesn't respond to 'get cursor pos' ESC sequence...)

> My initial proposal had a timeout-handling already:
> http://busybox.net/~aldot/bb/busybox.applet_resize.00c.diff
> 
> The timeouthandling was dropped since Rob vetoed it..
> To me it looks like the initial timeout proposal would be smaller and
> should work equally well, no?

Your code:

+#define RESIZE_TIOS_TIMEOUT 100 /* in deciseconds */
+int resize_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv) {
+       /* save_cursor_pos 7
+        * scroll_whole_screen [r
+        * put_cursor_waaaay_off [$x;$yH
+        * get_cursor_pos [6n
+        * restore_cursor_pos 8
+        */
+       struct winsize w = {0,0,0,0};
+       int ret;
+       struct termios old, new;
+       tcgetattr(STDOUT_FILENO, &old); /* fiddle echo */
+       new = old;
+       new.c_cflag |= (CLOCAL | CREAD);
+       new.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
+#if defined(RESIZE_TIOS_TIMEOUT) && (RESIZE_TIOS_TIMEOUT > 0)
+       new.c_cc[VMIN] = 0;
+       new.c_cc[VTIME] = RESIZE_TIOS_TIMEOUT;
+#endif

I must admit that I didn't know that new.c_cc[VTIME] exists,
let alone what does it mean.

Googled for it. Still not much info.
Care to enlighten me and other people on the list?

It is certainly smaller that what I committed.
If you are sure that it works reliably, you can commit this change
(please add small educational comment then)

Thanks!
--
vda


More information about the busybox mailing list