ncurses/terminfo problems

Ehud Karni ehud@unix.simonwiesel.co.il
Sun Nov 19 09:05:00 GMT 2000


Last week (Nov 14) I asked a question about TCGETS/TCSETS in cygwin,
I haven't received even a single answer. Since then I have encountered
some other problem with ncurses on cygwin. I solved all of them by now
and I have some observations.

The problems were:
1. No support for the ioctl call with TCGETS/TCSETS to get/set
   termios structure onto terminals in cygwin.
Solution:
   It seems that with cygwin ncurses TCGETA/TCSETA does exactly what I
   used to do with TCGETS/TCSETS. In the Linux ioctl_list man page
   TCGETS/TCSETS works on termios structure while TCGETA/TCSETA work on
   termio structure. In the cygwin porting termio and termios are
   exactly the same.
Required action: Defining TCGETS and TCSETS to be the same as TCGETA and
   TCSETS on the cygwin porting, Adding the above facts to the FAQ,
   README and the ioctl man page (which is missing in cygwin).

2. When calling setupterm the environment variables LINES and
   COLUMNS are not considered [ like a call to use_env(FALSE) has
   been done ] contrary to the Man page.
Solution:
   The cause is the function `_nc_get_screensize'. It checks both LINES
   and COLUMNS environment variables and if BOTH are set then their
   value is used (if ONLY one is set, it is ignored). Since I use cygwin
   bash in console mode I just set the LINES to 43 which of course did
   not work (my script on UNIX always sets both variables). the relevant
   part of the man page of ncurses is:

 Either COLUMNS or LINES symbols may be specified independently. This
 is mainly useful to circumvent legacy misfeatures of terminal descr-
 iptions, e.g., xterm which commonly specifies a 65 line screen.  For
 best results,  lines and cols  should not be specified in a terminal
 description for terminals which are run as emulations.

The following patch fix this problem:

diff -c ORIGINAL/ncurses-5.2/ncurses/tinfo/lib_setup.c  ~/lib_setup.c
*** ORIGINAL/ncurses-5.2/ncurses/tinfo/lib_setup.c  Sat Sep  2 21:13:12 2000
--- ~/lib_setup.c                                   Sun Nov 19 01:11:37 2000
***************
*** 165,174 ****
  #endif /* HAVE_SIZECHANGE */

  	/* if we can't get dynamic info about the size, use static */
! 	if (*linep <= 0 || *colp <= 0)
! 	    if (lines > 0 && columns > 0) {
! 		*linep = (int) lines;
! 		*colp = (int) columns;
  	    }

  	/* the ultimate fallback, assume fixed 24x80 size */
--- 165,175 ----
  #endif /* HAVE_SIZECHANGE */

  	/* if we can't get dynamic info about the size, use static */
! 	if (*linep <= 0 ) {
! 	    *linep = (int) lines;
! 	    }
! 	if (*colp <= 0) {
! 	    *colp = (int) columns;
  	    }

  	/* the ultimate fallback, assume fixed 24x80 size */

Diff finished at Sun Nov 19 01:14:01

Required action: Patch lib_setup.c or change the ncurses man page.


3. When compiling a program with ncurses in cygwin it needs the
   libncurses_dll library. The problem is that when neither NCURSES_DLL
   nor NCURSES_STATIC are defined, the DLL version is selected.
Solution:
   Define either NCURSES_DLL or NCURSES_STATIC.
Required action: Add this information to the README and the ncurses man
   page (the cygwin version).


Ehud.


--
 @@@@@@ @@@ @@@@@@ @    @   Ehud Karni  Simon & Wiesel  Insurance agency
     @    @      @  @@  @   Tel: +972-3-6212-757    Fax: +972-3-6292-544
     @    @ @    @ @  @@    (USA)  Fax  and  voice  mail:  1-815-5509341
     @    @ @    @ @    @        Better     Safe     Than     Sorry
 http://www.simonwiesel.co.il    mailto:ehud@unix.simonwiesel.co.il

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list