Subject: curses: waddnstr(w, str, 0)
To: None <tech-userlevel@netbsd.org>
From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
List: tech-userlevel
Date: 08/11/2000 22:01:38
	it looks that waddnstr(w, str, 0) behaves differently between
	netbsd curses (= BSD curses) and ncurses.  which behavior is
	more correct?  which side needs correction?

itojun


------- Forwarded Message

To: gnats-bugs@gnats.netbsd.org
In-reply-to: itojun's message of Fri, 11 Aug 2000 20:11:16 JST.
      <200008111111.e7BBBGN06060@ starfruit.itojun.org> 
Subject: Re: lib/10816: ncurses/curses incompat: pkgsrc/sysutils/whowatch 
From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
Date: Fri, 11 Aug 2000 22:00:37 +0900
Sender: itojun@localhost


>>Synopsis:       ncurses/curses incompat: pkgsrc/sysutils/whowatch
>>Description:
>	pkgsrc/sysutils/whowatch demonstrates incompatibility between
>	/usr/lib/libcurses and pkgsrc/devel/ncurses.
>>How-To-Repeat:
>	try to compile pkgsrc/sysutils/whowatch.  see screen crashes.
>	(first line damaged)
>>Fix:

	waddnstr(w, str, 0) behaves differently between netbsd curses
	and ncurses.

	netbsd curses, and curses in nvi: lib/libcurses/addnstr.c line 145
		if (n > 0)
			use n as length.
		else
			use strlen(str) as length.

		therefore, when n == 0, strlen(str) is used as length.

	ncurses: ncurses/base/lib_addstr.c
		if (n < 0)
			use strlen(str) as length.
		else
			use n as length.

		therefore, when n == 0, length goes 0 (no text will be printed).

	I wonder why behavior is the correct one.

itojun

------- End of Forwarded Message