diff options
author | Sebastian Morr | 2015-06-24 22:33:37 +0200 |
---|---|---|
committer | Sebastian Morr | 2015-06-24 22:33:37 +0200 |
commit | 36e6133998481f57248d1f72f0c779e1990938c1 (patch) | |
tree | 2013269710e8ed39be8e0f79dda5c9b13da98924 /get-w32-console-maxcols.mingw32.patch | |
download | aur-36e6133998481f57248d1f72f0c779e1990938c1.tar.gz |
Initial commit
Diffstat (limited to 'get-w32-console-maxcols.mingw32.patch')
-rw-r--r-- | get-w32-console-maxcols.mingw32.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/get-w32-console-maxcols.mingw32.patch b/get-w32-console-maxcols.mingw32.patch new file mode 100644 index 000000000000..9819f664d9a9 --- /dev/null +++ b/get-w32-console-maxcols.mingw32.patch @@ -0,0 +1,35 @@ +--- popt-1.16/popthelp.c.orig 2012-03-31 08:51:34 +0400 ++++ popt-1.16/popthelp.c 2012-03-31 09:08:28 +0400 +@@ -10,9 +10,11 @@ + + #include "system.h" + +-#define POPT_USE_TIOCGWINSZ ++#undef POPT_USE_TIOCGWINSZ + #ifdef POPT_USE_TIOCGWINSZ + #include <sys/ioctl.h> ++#elif defined(_WIN32_WINNT) && !defined(__CYGWIN__) ++#include <windows.h> + #endif + + #define POPT_WCHAR_HACK +@@ -123,8 +125,18 @@ + if (ws_col > maxcols && ws_col < (size_t)256) + maxcols = ws_col - 1; + } +-#endif + return maxcols; ++#elif defined(_WIN32_WINNT) && !defined(__CYGWIN__) ++ HANDLE hStdout; ++ CONSOLE_SCREEN_BUFFER_INFO cbi; ++ hStdout = GetStdHandle (STD_OUTPUT_HANDLE); ++ if (hStdout == INVALID_HANDLE_VALUE) ++ return maxcols; ++ if (0 == GetConsoleScreenBufferInfo (hStdout, &cbi)) ++ return maxcols; ++ else ++ return cbi.dwSize.X; ++#endif + } + + /** |