diff options
author | Pavel Vymetálek <pavel@vym.cz> | 2019-03-02 15:20:33 +0100 |
---|---|---|
committer | Pavel Vymetálek <pavel@vym.cz> | 2019-03-02 15:20:33 +0100 |
commit | 33e4233b0f7a6f7c1c3b5f17b0ae6fa4f882457b (patch) | |
tree | 49d5cfe0409f6e2fe41e5488b486ffbaf84610e3 /sercp.c | |
parent | f43a5c6f101fc801c5ac2a5925dfca2c00c19f02 (diff) | |
download | sercp-pc-33e4233b0f7a6f7c1c3b5f17b0ae6fa4f882457b.tar.gz |
Přidáno čtení šířky konzole i na Windows.
- testováno na wine a v XP a šířku ukazuje stále 80 znaků :-(
- otestovat na win7 a win10
Diffstat (limited to 'sercp.c')
-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); |