Package: tetrinet-client
Version: 0.11+CVS20031026-3
Severity: wishlist

please can you add a check for terminal size and abort when not large enough?
here's some code to start with:

static int get_term_size(int fd, int *x, int *y) {
#ifdef TIOCGSIZE
    struct ttysize win;
#elif defined(TIOCGWINSZ)
    struct winsize win;
#endif

#ifdef TIOCGSIZE
    if (ioctl(fd,TIOCGSIZE,&win)) return 0;
    if (y) *y=win.ts_lines;
    if (x) *x=win.ts_cols;
#elif defined TIOCGWINSZ
    if (ioctl(fd,TIOCGWINSZ,&win)) return 0;
    if (y) *y=win.ws_row;
    if (x) *x=win.ws_col;
#else
    {
        const char *s;
        s=getenv("LINES");   if (s) *y=strtol(s,NULL,10); else *y=25;
        s=getenv("COLUMNS"); if (s) *x=strtol(s,NULL,10); else *x=80;
    }
#endif
    return 1;
}

yours,
Gürkan


Reply via email to