[svn] Correctly determine screen size under Windows.

This commit is contained in:
hniksic 2004-01-28 05:42:52 -08:00
parent 2c0e2b0afa
commit 4d626daf5a
2 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2004-01-28 David Fritz <zeroxdf@att.net>
* utils.c (determine_screen_width): Correctly determine console
width under Windows.
2004-01-28 Christian Biere <christianbiere@gmx.de>
* progress.c (bar_set_params): Fixed syntax error when HAVE_ISATTY

View File

@ -1659,9 +1659,7 @@ determine_screen_width (void)
{
/* If there's a way to get the terminal size using POSIX
tcgetattr(), somebody please tell me. */
#ifndef TIOCGWINSZ
return 0;
#else /* TIOCGWINSZ */
#ifdef TIOCGWINSZ
int fd;
struct winsize wsz;
@ -1673,7 +1671,14 @@ determine_screen_width (void)
return 0; /* most likely ENOTTY */
return wsz.ws_col;
#endif /* TIOCGWINSZ */
#else /* not TIOCGWINSZ */
# ifdef WINDOWS
CONSOLE_SCREEN_BUFFER_INFO csbi;
if (!GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &csbi))
return 0;
return csbi.dwSize.X;
# endif /* WINDOWS */
#endif /* not TIOCGWINSZ */
}
/* Return a random number between 0 and MAX-1, inclusive.