support piping the output of client_test to a file or other process

This commit is contained in:
Arvid Norberg 2011-06-03 05:46:11 +00:00
parent 1a927787b1
commit bfe5dc798c
1 changed files with 10 additions and 7 deletions

View File

@ -1535,14 +1535,17 @@ int main(int argc, char* argv[])
#ifndef _WIN32
{
winsize size;
ioctl(STDOUT_FILENO, TIOCGWINSZ, (char*)&size);
terminal_width = size.ws_col;
terminal_height = size.ws_row;
int ret = ioctl(STDOUT_FILENO, TIOCGWINSZ, (char*)&size);
if (ret == 0)
{
terminal_width = size.ws_col;
terminal_height = size.ws_row;
if (terminal_width < 64)
terminal_width = 64;
if (terminal_height < 25)
terminal_height = 25;
if (terminal_width < 64)
terminal_width = 64;
if (terminal_height < 25)
terminal_height = 25;
}
}
#endif