ccmake: Use LSB 4.0 getmaxyx conditionally

Use of 'getmaxyx' works on LSB but does not seem portable to other
curses versions.
This commit is contained in:
Brad King 2011-01-05 11:07:24 -05:00
parent a3de30eed9
commit dde0c89cfc
2 changed files with 16 additions and 2 deletions

View File

@ -357,7 +357,12 @@ static void Buffer_To_Window(const FIELD * field, WINDOW * win)
assert(win && field); assert(win && field);
#if defined(__LSB_VERSION__)
getmaxyx(win, height, width); getmaxyx(win, height, width);
#else
width = getmaxx(win);
height = getmaxy(win);
#endif
for(row=0, pBuffer=field->buf; for(row=0, pBuffer=field->buf;
row < height; row < height;
@ -389,13 +394,17 @@ static void Window_To_Buffer(WINDOW * win, FIELD * field)
int pad; int pad;
int len = 0; int len = 0;
char *p; char *p;
int row, height, width; int row, height;
assert(win && field && field->buf ); assert(win && field && field->buf );
pad = field->pad; pad = field->pad;
p = field->buf; p = field->buf;
getmaxyx(win, height, width); #if defined(__LSB_VERSION__)
{ int width; getmaxyx(win, height, width); }
#else
height = getmaxy(win);
#endif
for(row=0; (row < height) && (row < field->drows); row++ ) for(row=0; (row < height) && (row < field->drows); row++ )
{ {

View File

@ -63,7 +63,12 @@ int post_form(FORM * form)
RETURN(E_NOT_CONNECTED); RETURN(E_NOT_CONNECTED);
formwin = Get_Form_Window(form); formwin = Get_Form_Window(form);
#if defined(__LSB_VERSION__)
getmaxyx(formwin, height, width); getmaxyx(formwin, height, width);
#else
width = getmaxx(formwin);
height = getmaxy(formwin);
#endif
if ((form->cols > width) || (form->rows > height)) if ((form->cols > width) || (form->rows > height))
RETURN(E_NO_ROOM); RETURN(E_NO_ROOM);