diff --git a/display.c b/display.c index 0c0e313..3185a0d 100644 --- a/display.c +++ b/display.c @@ -109,13 +109,13 @@ void vtinit(void) TTopen(); /* open the screen */ TTkopen(); /* open the keyboard */ TTrev(FALSE); - vscreen = xmalloc(term.t_mrow * sizeof(struct video *)); + vscreen = xmalloc( MAXROW * sizeof( struct video *)) ; #if MEMMAP == 0 || SCROLLCODE - pscreen = xmalloc(term.t_mrow * sizeof(struct video *)); + pscreen = xmalloc( MAXROW * sizeof( struct video *)) ; #endif - for (i = 0; i < term.t_mrow; ++i) { - vp = xmalloc(sizeof(struct video) + term.t_mcol*4); + for( i = 0 ; i < MAXROW ; ++i) { + vp = xmalloc( sizeof( struct video) + MAXCOL * 4) ; vp->v_flag = 0; #if COLOR vp->v_rfcolor = 7; @@ -123,7 +123,7 @@ void vtinit(void) #endif vscreen[i] = vp; #if MEMMAP == 0 || SCROLLCODE - vp = xmalloc(sizeof(struct video) + term.t_mcol*4); + vp = xmalloc( sizeof( struct video) + MAXCOL * 4 ) ; vp->v_flag = 0; pscreen[i] = vp; #endif @@ -136,7 +136,7 @@ void vtinit(void) void vtfree(void) { int i; - for (i = 0; i < term.t_mrow; ++i) { + for( i = 0 ; i < MAXROW; ++i ) { free(vscreen[i]); #if MEMMAP == 0 || SCROLLCODE free(pscreen[i]); diff --git a/tcap.c b/tcap.c index 5d25e52..4740342 100644 --- a/tcap.c +++ b/tcap.c @@ -144,30 +144,25 @@ static void tcapopen(void) } /* Get screen size from system, or else from termcap. */ - getscreensize(&int_col, &int_row); - term.t_nrow = int_row - 1; - term.t_ncol = int_col; - - if ((term.t_nrow <= 0) - && (term.t_nrow = (short) tgetnum("li") - 1) == -1) { + getscreensize( &int_col, &int_row) ; + if( (int_row <= 0) + && ((int_row = tgetnum("li")) == -1)) { fputs( "termcap entry incomplete (lines)\n", stderr) ; exit( EXIT_FAILURE) ; } - if ((term.t_ncol <= 0) - && (term.t_ncol = (short) tgetnum("co")) == -1) { + if( (int_col <= 0) + && ((int_col = tgetnum("co")) == -1)) { fputs( "Termcap entry incomplete (columns)\n", stderr) ; exit( EXIT_FAILURE) ; } #ifdef SIGWINCH /* At initialization we use maximum size even if current OS window is smaller */ - term.t_mrow = MAXROW ; - term.t_mcol = MAXCOL ; - if( term.t_nrow >= term.t_mrow) - term.t_nrow = term.t_mrow - 1 ; - - if( term.t_ncol > term.t_mcol) - term.t_ncol = term.t_mcol ; + term.t_mrow = int_row < MAXROW ? int_row : MAXROW ; + term.t_nrow = term.t_mrow - 1 ; + term.t_mcol = int_col < MAXCOL ? int_col : MAXCOL ; + term.t_ncol = term.t_mcol ; + #else term.t_mrow = term.t_nrow > MAXROW ? MAXROW : term.t_nrow; term.t_mcol = term.t_ncol > MAXCOL ? MAXCOL : term.t_ncol;