[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 06/09: progress-bar: get screen width on windows
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 06/09: progress-bar: get screen width on windows |
Date: |
Sat, 27 Jan 2018 15:14:35 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit a0b5e894455aed4624682064b511d6522af7e6b2
Author: Gisle Vanem <address@hidden>
AuthorDate: Tue Jan 23 22:41:50 2018 +0100
progress-bar: get screen width on windows
---
src/tool_cb_prg.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/tool_cb_prg.c b/src/tool_cb_prg.c
index dd8941631..cf3251b29 100644
--- a/src/tool_cb_prg.c
+++ b/src/tool_cb_prg.c
@@ -202,6 +202,21 @@ void progressbarinit(struct ProgressData *bar,
struct winsize ts;
if(!ioctl(STDIN_FILENO, TIOCGWINSZ, &ts))
cols = ts.ws_col;
+#elif defined(_WIN32)
+ {
+ HANDLE stderr_hnd = GetStdHandle(STD_ERROR_HANDLE);
+ CONSOLE_SCREEN_BUFFER_INFO console_info;
+
+ if((stderr_hnd != INVALID_HANDLE_VALUE) &&
+ GetConsoleScreenBufferInfo(stderr_hnd, &console_info)) {
+ /*
+ * Do not use +1 to get the true screen-width since writing a
+ * character at the right edge will cause a line wrap.
+ */
+ cols = (int)
+ (console_info.srWindow.Right - console_info.srWindow.Left);
+ }
+ }
#endif /* TIOCGSIZE */
bar->width = cols;
}
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] branch master updated (cc5f34a99 -> 60bd2bed8), gnunet, 2018/01/27
- [GNUnet-SVN] [gnurl] 04/09: CONNECT_TO: fail attempt to set an IPv6 numerical without IPv6 support, gnunet, 2018/01/27
- [GNUnet-SVN] [gnurl] 01/09: curl: progress bar refresh, get width using ioctl(), gnunet, 2018/01/27
- [GNUnet-SVN] [gnurl] 02/09: http: prevent custom Authorization headers in redirects, gnunet, 2018/01/27
- [GNUnet-SVN] [gnurl] 06/09: progress-bar: get screen width on windows,
gnunet <=
- [GNUnet-SVN] [gnurl] 03/09: docs: fix man page syntax to make test 1140 OK again, gnunet, 2018/01/27
- [GNUnet-SVN] [gnurl] 05/09: test1454: --connect-to with IPv6 address w/o IPv6 support!, gnunet, 2018/01/27
- [GNUnet-SVN] [gnurl] 08/09: Merge tag 'curl-7_58_0' of https://github.com/curl/curl, gnunet, 2018/01/27
- [GNUnet-SVN] [gnurl] 09/09: gnURL: rename guix-gnurl to guix, gnunet, 2018/01/27
- [GNUnet-SVN] [gnurl] 07/09: RELEASE: 7.58.0, gnunet, 2018/01/27