diff options
author | Ed Schouten <ed@FreeBSD.org> | 2008-05-23 14:24:33 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2008-05-23 14:24:33 +0000 |
commit | 81590c5b3704d78a2a08502cc6eb53fdc7d09687 (patch) | |
tree | 2d2798e036e6e624e5f1a19ee5f52df09041e35b /usr.sbin | |
parent | 741b6cf8a565f75b3868bea8a0c4c0e247e23d24 (diff) | |
download | src-81590c5b3704d78a2a08502cc6eb53fdc7d09687.tar.gz src-81590c5b3704d78a2a08502cc6eb53fdc7d09687.zip |
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)
Notes
Notes:
svn path=/head/; revision=179244
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/sade/termcap.c | 8 | ||||
-rw-r--r-- | usr.sbin/sysinstall/termcap.c | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/usr.sbin/sade/termcap.c b/usr.sbin/sade/termcap.c index 5cf0f2740bb1..3e80a415bbb0 100644 --- a/usr.sbin/sade/termcap.c +++ b/usr.sbin/sade/termcap.c @@ -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; } diff --git a/usr.sbin/sysinstall/termcap.c b/usr.sbin/sysinstall/termcap.c index ca5905a2602f..0df0a77cb5ed 100644 --- a/usr.sbin/sysinstall/termcap.c +++ b/usr.sbin/sysinstall/termcap.c @@ -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; } |