Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Sep 1999 09:52:10 -0400 (EDT)
From:      Luoqi Chen <luoqi@watermarkgroup.com>
To:        current@freebsd.org
Subject:   new ncurses lib changed tgetstr() API
Message-ID:  <199909011352.JAA05804@lor.watermarkgroup.com>

next in thread | raw e-mail | index | archive | help
After the import of ncurses 5.0 (beta?), I noticed strange behavior of clear
on my xterm. I tracked it down to an API change of tgetstr(), here is the
new code:

    char *tgetstr(NCURSES_CONST char *id, char **area GCC_UNUSED)
    {
    int i;
     
	    T((T_CALLED("tgetstr(%s,%p)"), id, area));
	    if (cur_term != 0) {
		TERMTYPE *tp = &(cur_term->type);
		for_each_string(i, tp) {
		    const char *capname = ExtStrname(tp, i, strcodes);
		    T(("trying %s", capname));
		    if (!strncmp(id, capname, 2)) {
			T(("found match : %s", _nc_visbuf(tp->Strings[i])));
			/* setupterm forces cancelled strings to null */
			returnPtr(tp->Strings[i]);
		    }
		}
	    }
	    returnPtr(NULL);
    }

and here is what termcap(3) says,

    char *
    tgetstr(const char *id, char **area)

    The tgetstr() function returns the string value of the capability id,
    places it in the buffer at area, and advances the area pointer.
    It decodes the abbreviations for this field described in termcap(5),
    except for cursor addressing and padding information.  The tgetstr()
    function returns NULL if the capability was not found.

The new code doesn't copy the cap string to the provided storage area, and
programs like tset and tputs expect that.

-lq


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199909011352.JAA05804>