Re: Linux 2.6.7 (stty rows 50 columns 140 reports : No such device or address)

Egmont Koblinger
2004-06-16T21:18:10Z

On Wed, 16 Jun 2004 jsimmons@pentafluge.infradead.org wrote:

Hi,

> +#ifdef TIOCGWINSZ
> + int size_was_set = 0;
> + int cols, rows;
^^^^^^^^^^^^^^^
These should both be initialized to -1 because...

> - set_window_size ((int) integer_arg (argv[k]), -1,
> - fd, device_name);
> + rows = integer_arg (argv[k]);
> + size_was_set = 1;

[...]

> - set_window_size (-1, (int) integer_arg (argv[k]),
> - fd, device_name);
> + cols = integer_arg (argv[k]);
> + size_was_set = 1;

...here maybe only one of them is set, but...

> + if (size_was_set)
> + {
> + set_window_size (rows, cols, fd, device_name);

...here both of them are used. Looking at the body of size_was_set()
and the code that was removed from stty it's clear that -1 means don't
change, while 0 means change to 0.

--
Egmont