#include "term.h" int term_init_data( term_screen *term ) { int ret=0; term->term_col = term_get_col(); if (term->term_col == -1) ret = -1; term->term_row = term_get_row(); if (term->term_row == -1) ret = -1; term->mode = SCREEN_MODE_80x24; return ret; } int term_get_col( ) { int ret=-1; int fret=-1; struct winsize w; fret = ioctl(0, TIOCGWINSZ, &w ); if ( fret == 0 ) { return w.ws_col; } return -1; } int term_get_row( ) { int ret=-1; int fret=-1; struct winsize w; fret = ioctl(0, TIOCGWINSZ, &w ); if ( fret == 0 ) { return w.ws_row; } return -1; }