rn bug #24
Larry Wall
lwall at sdcrdcf.UUCP
Sat Dec 1 11:16:45 AEST 1984
System: rn version 4.1
Bug #: 24
Priority: MEDIUM
Subject: rn won't work with terminfo -lcurses
Index: term.c
Prereq: 4.1
From: ptsfa!dsp
Description:
The terminfo tgetstr() routine in -lcurses doesn't quite act like
4.xBSD documentation says. Namely, it doesn't leave the string at the
address passed as the second argument. This breaks rn.
Repeat-By:
Compile up rn with -lcurses. If you don't get any terminal
capabilities, you have the problem.
Fix: From rn, say "| patch -d DIR", where DIR is your rn source directory.
Outside of rn, say "cd DIR; patch <thisarticle". If you don't have
the patch program, apply the following by hand, or get patch.
***************
*** 1,4
! /* $Header: term.c,v 4.1 84/09/24 12:10:42 lwall Exp $
*
* $Log: term.c,v $
* Revision 4.1 84/09/24 12:10:42 lwall
--- 1,4 -----
! /* $Header: term.c,v 4.1.1.2 84/11/30 16:32:38 lwall Exp $
*
* $Log: term.c,v $
* Revision 4.1.1.2 84/11/30 16:32:38 lwall
***************
*** 1,6
/* $Header: term.c,v 4.1 84/09/24 12:10:42 lwall Exp $
*
* $Log: term.c,v $
* Revision 4.1 84/09/24 12:10:42 lwall
* Real baseline.
*
--- 1,12 -----
/* $Header: term.c,v 4.1.1.2 84/11/30 16:32:38 lwall Exp $
*
* $Log: term.c,v $
+ * Revision 4.1.1.2 84/11/30 16:32:38 lwall
+ * Now uses tgetstr() compatibly with both termlib and terminfo.
+ *
+ * Revision 4.1.1.1 84/09/25 13:26:55 lwall
+ * Branch for sdcrdcf changes.
+ *
* Revision 4.1 84/09/24 12:10:42 lwall
* Real baseline.
*
***************
*** 35,40
char KILLCH; /* line delete character */
char tcarea[TCSIZE]; /* area for "compiled" termcap strings */
/* terminal initialization */
void
--- 41,51 -----
char KILLCH; /* line delete character */
char tcarea[TCSIZE]; /* area for "compiled" termcap strings */
+ /* guarantee capability pointer != Nullch */
+ /* (I believe terminfo will ignore the &tmpaddr argument.) */
+
+ #define Tgetstr(key) ((tmpstr = tgetstr(key,&tmpaddr)) ? tmpstr : nullstr)
+
/* terminal initialization */
void
***************
*** 41,47
term_init(tcbuf)
char *tcbuf; /* temp area for "uncompiled" termcap entry */
{
! char *tmpaddr;
int status;
#ifndef read_tty
--- 52,61 -----
term_init(tcbuf)
char *tcbuf; /* temp area for "uncompiled" termcap entry */
{
! char *tmpaddr; /* must not be register */
! register char *tmpstr;
! char *tgetstr();
! char *s;
int status;
#ifndef read_tty
***************
*** 79,90
finalize(1);
}
tmpaddr = tcarea; /* set up strange tgetstr pointer */
! tgetstr("pc",&tmpaddr); /* get pad character */
! PC = *tcarea; /* get it where tputs wants it */
! if (!tgetflag("bs")) { /* is backspace not used? */
! BC = tmpaddr; /* find out what is */
! tgetstr("bc",&tmpaddr);
! }
else
BC = "\010"; /* make a backspace handy */
UP = tmpaddr; /* move up a line */
--- 93,102 -----
finalize(1);
}
tmpaddr = tcarea; /* set up strange tgetstr pointer */
! s = Tgetstr("pc"); /* get pad character */
! PC = *s; /* get it where tputs wants it */
! if (!tgetflag("bs")) /* is backspace not used? */
! BC = Tgetstr("bc"); /* find out what is */
else
BC = "\b"; /* make a backspace handy */
UP = Tgetstr("up"); /* move up a line */
***************
*** 86,94
tgetstr("bc",&tmpaddr);
}
else
! BC = "\010"; /* make a backspace handy */
! UP = tmpaddr; /* move up a line */
! tgetstr("up",&tmpaddr);
if (!*UP) /* no UP string? */
marking = 0; /* disable any marking */
if (muck_up_clear) /* this is for weird HPs */
--- 98,105 -----
if (!tgetflag("bs")) /* is backspace not used? */
BC = Tgetstr("bc"); /* find out what is */
else
! BC = "\b"; /* make a backspace handy */
! UP = Tgetstr("up"); /* move up a line */
if (!*UP) /* no UP string? */
marking = 0; /* disable any marking */
if (muck_up_clear) /* this is for weird HPs */
***************
*** 93,108
marking = 0; /* disable any marking */
if (muck_up_clear) /* this is for weird HPs */
CL = "\n\n\n\n";
! else {
! CL = tmpaddr; /* get clear string */
! tgetstr("cl",&tmpaddr);
! }
! CE = tmpaddr; /* clear to end of line string */
! tgetstr("ce",&tmpaddr);
! SO = tmpaddr; /* begin standout */
! tgetstr("so",&tmpaddr);
! SE = tmpaddr; /* end standout */
! tgetstr("se",&tmpaddr);
if ((SG = tgetnum("sg"))<0)
SG = 0; /* blanks left by SG, SE */
US = tmpaddr; /* start underline */
--- 104,114 -----
marking = 0; /* disable any marking */
if (muck_up_clear) /* this is for weird HPs */
CL = "\n\n\n\n";
! else
! CL = Tgetstr("cl"); /* get clear string */
! CE = Tgetstr("ce"); /* clear to end of line string */
! SO = Tgetstr("so"); /* begin standout */
! SE = Tgetstr("se"); /* end standout */
if ((SG = tgetnum("sg"))<0)
SG = 0; /* blanks left by SG, SE */
US = Tgetstr("us"); /* start underline */
***************
*** 105,114
tgetstr("se",&tmpaddr);
if ((SG = tgetnum("sg"))<0)
SG = 0; /* blanks left by SG, SE */
! US = tmpaddr; /* start underline */
! tgetstr("us",&tmpaddr);
! UE = tmpaddr; /* end underline */
! tgetstr("ue",&tmpaddr);
if ((UG = tgetnum("ug"))<0)
UG = 0; /* blanks left by US, UE */
if (*US)
--- 111,118 -----
SE = Tgetstr("se"); /* end standout */
if ((SG = tgetnum("sg"))<0)
SG = 0; /* blanks left by SG, SE */
! US = Tgetstr("us"); /* start underline */
! UE = Tgetstr("ue"); /* end underline */
if ((UG = tgetnum("ug"))<0)
UG = 0; /* blanks left by US, UE */
if (*US)
***************
*** 113,122
UG = 0; /* blanks left by US, UE */
if (*US)
UC = nullstr; /* UC must not be NULL */
! else {
! UC = tmpaddr; /* underline a character */
! tgetstr("uc",&tmpaddr);
! }
if (!*US && !*UC) { /* no underline mode? */
US = SO; /* substitute standout mode */
UE = SE;
--- 117,124 -----
UG = 0; /* blanks left by US, UE */
if (*US)
UC = nullstr; /* UC must not be NULL */
! else
! UC = Tgetstr("uc"); /* underline a character */
if (!*US && !*UC) { /* no underline mode? */
US = SO; /* substitute standout mode */
UE = SE;
More information about the Comp.sources.bugs
mailing list