src/sysdep.c (get_tty_size) [WINDOWSNT]: Implement.
Fixes: debbugs:8596
This commit is contained in:
parent
9f5e78f7d5
commit
e16e55d4a0
2 changed files with 22 additions and 8 deletions
|
@ -1,3 +1,7 @@
|
|||
2011-05-02 Juanma Barranquero <lekktu@gmail.com>
|
||||
|
||||
* sysdep.c (get_tty_size) [WINDOWSNT]: Implement. (Bug#8596)
|
||||
|
||||
2011-05-02 Juanma Barranquero <lekktu@gmail.com>
|
||||
|
||||
* gnutls.c (Qgnutls_log_level, Qgnutls_code, Qgnutls_anon)
|
||||
|
|
26
src/sysdep.c
26
src/sysdep.c
|
@ -1125,8 +1125,7 @@ tabs_safe_p (int fd)
|
|||
void
|
||||
get_tty_size (int fd, int *widthp, int *heightp)
|
||||
{
|
||||
|
||||
#ifdef TIOCGWINSZ
|
||||
#if defined TIOCGWINSZ
|
||||
|
||||
/* BSD-style. */
|
||||
struct winsize size;
|
||||
|
@ -1139,8 +1138,7 @@ get_tty_size (int fd, int *widthp, int *heightp)
|
|||
*heightp = size.ws_row;
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef TIOCGSIZE
|
||||
#elif defined TIOCGSIZE
|
||||
|
||||
/* SunOS - style. */
|
||||
struct ttysize size;
|
||||
|
@ -1153,16 +1151,28 @@ get_tty_size (int fd, int *widthp, int *heightp)
|
|||
*heightp = size.ts_lines;
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef MSDOS
|
||||
#elif defined WINDOWSNT
|
||||
|
||||
CONSOLE_SCREEN_BUFFER_INFO info;
|
||||
if (GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info))
|
||||
{
|
||||
*widthp = info.srWindow.Right - info.srWindow.Left + 1;
|
||||
*heightp = info.srWindow.Bottom - info.srWindow.Top + 1;
|
||||
}
|
||||
else
|
||||
*widthp = *heightp = 0;
|
||||
|
||||
#elif defined MSDOS
|
||||
|
||||
*widthp = ScreenCols ();
|
||||
*heightp = ScreenRows ();
|
||||
|
||||
#else /* system doesn't know size */
|
||||
|
||||
*widthp = 0;
|
||||
*heightp = 0;
|
||||
|
||||
#endif
|
||||
#endif /* not SunOS-style */
|
||||
#endif /* not BSD-style */
|
||||
}
|
||||
|
||||
/* Set the logical window size associated with descriptor FD
|
||||
|
|
Loading…
Add table
Reference in a new issue