Date: Wed, 9 Sep 92 12:38:34 +0200 From: kunst AT prl DOT philips DOT nl (Pieter Kunst) Subject: curses endwin() bug and patch Reply-To: kunst AT prl DOT philips DOT nl To: dj AT ctron DOT com Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Hello DJ, Perhaps I'm a bit old-fashioned for still using 'curses' nowadays while everybody is talking about the latest GUIs like DV/X and the like... A while ago I posted a question about using the arrow keys with the 'curses' library from the contrib section. I didn't get any reply, so I assume that not many people use 'curses' for their terminal I/O. I need it however for portability reasons. The questions I had have been resolved for the greatest part: most of them (e.g. arrow keys) have to do with the differences between the BSD 4.3 and the System V implementation of the 'curses' library, so it looks like the 'curses' library isn't so portable at all... One annoying property of the 'curses' version in the contrib section is a very small bug in the 'endwin()' function which tries to restore the original screen (before curses was activated). Somewhere down the code the parameters in the puttext() and gettext() (from gppconio.c) have been reversed. I include a patch at the end of this message. I have found some other non-portabilities (even for a BSD 4.3 curses) which I will post later. If more people are interested I can put my System V patches in a separate file to be included with new releases of 'curses'. Pieter Kunst (kunst AT prl DOT philips DOT nl) ------------------ contrib/curses/src/cvidintf.c diff --------------------- *** cvidintf.org Wed Sep 9 12:14:38 1992 --- cvidintf.c Wed Sep 9 12:15:21 1992 *************** *** 295,301 **** movblock(__VIDADDR.farptr, savep, VID_BUFF_SIZE); #endif /* AZTEC */ #ifdef __GNUC__ ! gettext(1, 1, 25, 80, savep); #endif vid_get_curs_info(&buffp->c_posn, &buffp->c_size); } --- 295,301 ---- movblock(__VIDADDR.farptr, savep, VID_BUFF_SIZE); #endif /* AZTEC */ #ifdef __GNUC__ ! gettext(1, 1, 80, 25, savep); #endif vid_get_curs_info(&buffp->c_posn, &buffp->c_size); } *************** *** 322,328 **** movblock(savep, __VIDADDR.farptr, VID_BUFF_SIZE); #endif /* AZTEC */ #ifdef __GNUC__ ! puttext(1, 1, 25, 80, savep); #endif vid_set_curs_info(&buffp->c_posn, &buffp->c_size); } --- 322,328 ---- movblock(savep, __VIDADDR.farptr, VID_BUFF_SIZE); #endif /* AZTEC */ #ifdef __GNUC__ ! puttext(1, 1, 80, 25, savep); #endif vid_set_curs_info(&buffp->c_posn, &buffp->c_size); }