diff options
-rw-r--r-- | sercp.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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); |