Curses bug in V/AT 2.4 - what was it ???

Bob Thrush x210 rd at tarpit.UUCP
Thu Jun 22 08:19:21 AEST 1989


In article <353 at osc.COM> rp at osc.COM (Rich Patterson) writes:
>Hi,
>	I remember a couple of months ago that there is a bug in the
>curses support under System V/AT ver. 2.4.  Does anybody remember what it
>was ??  Also, if anybody has a fix for it that would be appreciated.  Please
>either post or e-mail directly to me.

  I don't have my earlier posting about this problem handy; however ...

  tgetstr() is broken.  I have attached a copy of a small source
module that may be used to workaround the problem.  If somebody
has a more direct solution, it would be preferable to this workaround.

#include <stdio.h>

/* The Microport tgetstr function is broken.  tgetstr should
 * have the following prototype:
 *   char *tgetstr(key,tcarea)
 *   char *key, **tcarea;
 * A proper termcap version should copy the (key) capability string
 * to tcarea, update the tcarea pointer, and return a pointer 
 * to the desired capability.
 * The Microport version appears to have something like the
 * following prototype:
 *   char *tgetstr(key,tcarea)
 *   char *key, *tcarea;
 * If tcarea is non-NULL, the Microport version copies the capability 
 * to the latter tcarea and returns a pointer to its own internal copy 
 * of the capability.  If tcarea is NULL, then it does not do the
 * above copy; however, it still returns the pointer.
 *
 * Since compatible performance is desired, I have written the following
 * routine to interface to the broken Microport tgetstr.
 *
 * To use Tgetstr, define the following macro and function declaration
 * before tgetstr is used:
#define tgetstr(key,tcarea) (Tgetstr(key,tcarea))
char *Tgetstr();
 *
 * Then link this source module with the rest of your package.
 * 
 */

char *Tgetstr(key,p)
char *key, **p;
{
  char  *tgetstr();     		       /* Get termcap capability */
  char *strcpy();
  char *tmpstr;
  char *curses_cap_str;

  curses_cap_str=tgetstr(key,0L);
  if (curses_cap_str)
  {
	tmpstr = *p;
  	(void) strcpy(*p, curses_cap_str);
	*p += strlen(curses_cap_str);
	(*p)++;
  }
  else
	tmpstr = NULL;
  return tmpstr;
}

>
>Thanks,
>Rich P.
>rp at osc.com
>pacbell!osc!rp
-- 
Bob Thrush                 UUCP: {ucf-cs,rtmvax}!tarpit!rd
Automation Intelligence,   1200 W. Colonial Drive, Orlando, Florida 32804



More information about the Comp.unix.microport mailing list