Move sysinstall/sade away from TIOCGSIZE.

Both sysinstall and sade still seem to use the TIOCGSIZE ioctl to obtain
the terminal dimensions. We'd better use TIOCGWINSZ to do this. The
TIOCGWINSZ interface is preferred, because it also allows sizes in pixels
to be passed to the application (though this is not used here).

Approved by:	philip (mentor)
This commit is contained in:
Ed Schouten 2008-05-23 14:24:33 +00:00
parent 741b6cf8a5
commit 81590c5b37
2 changed files with 8 additions and 8 deletions

View File

@ -39,7 +39,7 @@ set_termcap(void)
{
char *term;
int stat;
struct ttysize ts;
struct winsize ws;
term = getenv("TERM");
stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay);
@ -95,10 +95,10 @@ set_termcap(void)
}
#endif
}
if (ioctl(0, TIOCGSIZE, &ts) == -1) {
if (ioctl(0, TIOCGWINSZ, &ws) == -1) {
msgDebug("Unable to get terminal size - errno %d\n", errno);
ts.ts_lines = 0;
ws.ws_row = 0;
}
StatusLine = ts.ts_lines ? ts.ts_lines - 1: (OnVTY ? VTY_STATUS_LINE : TTY_STATUS_LINE);
StatusLine = ws.ws_row ? ws.ws_row - 1: (OnVTY ? VTY_STATUS_LINE : TTY_STATUS_LINE);
return 0;
}

View File

@ -75,7 +75,7 @@ set_termcap(void)
{
char *term;
int stat;
struct ttysize ts;
struct winsize ws;
term = getenv("TERM");
stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay);
@ -141,10 +141,10 @@ set_termcap(void)
}
#endif
}
if (ioctl(0, TIOCGSIZE, &ts) == -1) {
if (ioctl(0, TIOCGWINSZ, &ws) == -1) {
msgDebug("Unable to get terminal size - errno %d\n", errno);
ts.ts_lines = 0;
ws.ws_row = 0;
}
StatusLine = ts.ts_lines ? ts.ts_lines - 1: (OnVTY ? VTY_STATUS_LINE : TTY_STATUS_LINE);
StatusLine = ws.ws_row ? ws.ws_row - 1: (OnVTY ? VTY_STATUS_LINE : TTY_STATUS_LINE);
return 0;
}