Re: minicom display problems
In article <[🔎] 432B0ABF.email@example.com>,
Marty <firstname.lastname@example.org> wrote:
>I mercifully forgot everything I knew about terminals in the '80s,
>But now I am puzzled by two purely theoretical questions:
>1) why don't LINE and COLUMN get listed when I run "printenv"?
Because the resize command prints out the commands you need to
execute; it doesn't actually do anything else. This is because
a child process cannot set the environment variables of its
parent (or any other process).
If you run `resize` (note the backticks) the shell will take the
standard output of the command and execute it.
Oh. I see that resize actually sets the lines/columns
property of the tty using the TIOCSWINSZ (I used strace to see that)
ioctl. too Which means you don't have to set LINES and COLUMNS.
You can just run resize as "resize >/dev/null".
You see, in the old days, with fixed-size terminals, there was
no way to change the lines/columns of a tty. Then when windowing
systems were invented, and xterms, a way to tell the text-application
the number of lines and columns was needed. For that, the apps
looked at the LINES and COLUMNS enviroment variable which override
the lines and columns set in the termcap or terminfo file.
Later, a tty property was added for lines/columns. You can see it
when you do "stty -a". The ioctls TIOCGWINSZ and TIOCSWINSZ were
added to get/set that property from the ttyfd.
Now if you resize a tty window, the window manager also sets the
lines/columns property of the terminal, and sends the app running
in the terminal the SIGWINCH character so that it can resize.
So modern apps first look at LINES/COLUMNS, then at lines/columns
from the tty properties (TIOCGWINSZ), then at termcap/terminfo.
>2) How does "resize" retrieve the TTY properties via minicom, and why
>can't the remote shell automatically do likewise?
The resize command uses VT100 escape sequences to query the
terminal size. Why shouldn't the remote shell do this ?
Why doesn't the shell have all of /bin and /usr/bin built-in ?