+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
{
/* 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;
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.