Bug in 'curse'

Cesar Quiroz quiroz at rochester.UUCP
Sat Apr 20 07:29:36 AEST 1985


A minor problem with 'curse':  When it cannot find an ll entry for your
terminal, it blindly assumes you have a 24 line one.  However, it could 
get good information about the size of the screen by simply looking at 
LINES and COLS.  So, the shell archive at the end of this message 
provides the fixes both to the program and the man page.  I have added
two options, so you can query the number of lines/columns (and may be set
shell variables).  

Cesar

CUT HERE -----------------------------------------------------------------------
# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by seneca!quiroz on Fri Apr 19 16:19:01 EST 1985
# Contents:  FIXES diff.c diff.1
 
echo x - FIXES
sed 's/^@//' > "FIXES" <<'@//E*O*F FIXES//'
 
 DESCRIPTION:
                'curse' doesn't use the current size of the window
 when the -ll option cannot find a 'quick to last line' entry in the
 termcap.

 REPEAT-BY:     
                If you have a terminal which is NOT 24 lines tall and
 whose termcap entry doesn't contain the 'll' option, run:

 curse -ll

 You'll end up some weird place (column 0, line 23).

 FIX-BY:
                Use LINES and COLS, as defined by 'curses', in order
 to figure out your screen's size.  This allows for two easy options
 to get the numbers of lines and columns of your terminal, say in 
 shell variables:  

 lines=`curse -li`
 or
 set lines=`curse -li`

 diff.{c,1}  are ed(1) scripts for curse.c and curse.1 respectively.
 The two new options are -li and -co.
@//E*O*F FIXES//
chmod u=rw,g=rw,o=r FIXES
 
echo x - diff.c
sed 's/^@//' > "diff.c" <<'@//E*O*F diff.c//'
60c
			else move(0,LINES-1);
@.
57a
		else if ((c1 == 'l') && (c2 == 'i')) printf("%d",LINES);
@.
44a
		else if ((c1 == 'c') && (c2 == 'o')) printf("%d",COLS);
@.
28a
			printf("Numeric valued capabilities:\n");
			printf("li and co\n");
@.
@//E*O*F diff.c//
chmod u=rw,g=rw,o=r diff.c
 
echo x - diff.1
sed 's/^@//' > "diff.1" <<'@//E*O*F diff.1//'
16c
type variables are included.  In addition, two numeric options 
(-li and -co) are recognized, so you can adapt your work to any 
screen shape size.
@.
@//E*O*F diff.1//
chmod u=rw,g=rw,o=r diff.1
 
exit 0



More information about the Comp.sources.bugs mailing list