1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[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> 2004-01-28 Christian Biere <christianbiere@gmx.de>
* progress.c (bar_set_params): Fixed syntax error when HAVE_ISATTY * 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 /* If there's a way to get the terminal size using POSIX
tcgetattr(), somebody please tell me. */ tcgetattr(), somebody please tell me. */
#ifndef TIOCGWINSZ #ifdef TIOCGWINSZ
return 0;
#else /* TIOCGWINSZ */
int fd; int fd;
struct winsize wsz; struct winsize wsz;
@ -1673,7 +1671,14 @@ determine_screen_width (void)
return 0; /* most likely ENOTTY */ return 0; /* most likely ENOTTY */
return wsz.ws_col; 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. /* Return a random number between 0 and MAX-1, inclusive.