aboutsummaryrefslogtreecommitdiffstats
path: root/sercp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sercp.c')
-rw-r--r--sercp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sercp.c b/sercp.c
index ea9388d..9364abc 100644
--- a/sercp.c
+++ b/sercp.c
@@ -232,7 +232,14 @@ void signal_handler_sigterm (int status) {
/************************************************************************/
int GetTerminalWidth(void) {
#ifdef __WIN32
- return (80);
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+ int columns;
+// int rows;
+
+ GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
+ columns = csbi.srWindow.Right - csbi.srWindow.Left + 1;
+// rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
+ return (columns);
#else
struct winsize termsize;
ioctl (STDOUT_FILENO, TIOCGWINSZ, &termsize);