github.com/Konstantin8105/c4go@v0.0.0-20240505174241-768bb1c65a51/tests/ioctl.c (about) 1 #include "tests.h" 2 #include <fcntl.h> 3 #include <stdio.h> 4 #include <sys/ioctl.h> 5 #include <termios.h> 6 #include <unistd.h> 7 8 int main() 9 { 10 plan(0); 11 12 //------- 13 struct winsize sz; 14 printf("Call:%d\n", TIOCGWINSZ); 15 (void)sz; 16 int res = ioctl(STDIN_FILENO, TIOCGWINSZ, &sz); 17 printf("Res :%d\n", res); 18 if (res > 0) { 19 printf("Desr:%d\n", STDIN_FILENO); 20 is_true(sz.ws_col > 0); 21 is_true(sz.ws_row > 0); 22 printf("%5d %5d\n", sz.ws_col, sz.ws_row); 23 fail("Not acceptable"); 24 } 25 //------- 26 27 done_testing(); 28 }