[comp.unix.i386] Curses SysV R2 -> SysV R3: box

martin@mwtech.UUCP (Martin Weitzel) (07/03/90)

In porting a small Curses application developped under SysV R2
to R3, I found an incompatibility in the implementation of the
box() function/macro.

Besides the WINDOW* parameter, traditionally this function had
two parameters used for the horicontal and the vertical border
character. Possible usages were:

	box(stdsrc, '|', '-');            |-----------------|
	                                  |  box drawn      |
	                                  |-----------------|

	box(stdsrc, '*', '*');            *******************
	                                  *  box drawn      *
	                                  *******************

	box(stdscr, ' ', ' ');               box cleared

box(stdscr, 0, 0) would result in "appropriate default characters"
beeing used under SysV R2. If you use the last form under SysV R3,
pseudo graphic is used where available, and boxes look really nice.
But the implementation has a bug: For the 4 corners the graphic
characters now are *allways* used, so you loose the ability to
draw boxes in the first three shapes, and especially you can't
clear boxes with using blanks for the border characters.

Tracing the problem in "/usr/include/curses.h" reveals that "box()"
was replaced by "border()" and "wborder()" which I don't find in my
FM(%), but obviously these functions are the logical consequence of
the fact that you really need more than two different border characters
for nice boxes ("border()" is the "stdscr"-version of "wborder()").

The problem is in the line

	#define box(win,v,h)	wborder((win),(v),(v),(h),(h),0,0,0,0)

which IMHO better should be changed to

	#define box(win,v,h)	wborder((win),(v),(v),(h),(h),(v),(v),(v),(v))

to stay compatible with older applications.

%: BTW, tracing this problem also showed that there are several other
new functions/macros which are not listed in the FM. In most cases
you can guess the purpose from the names, but I'm curious if these
new features are not yet fully implemented or supported, if someone
was just lazy in not updating the documentation, or if ISC has supplied
me with an out-dated version of the programmers reference manual.)
-- 
Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83

shwake@raysnec.UUCP (Ray Shwake) (07/11/90)

In article <831@mwtech.UUCP> martin@mwtech.UUCP (Martin Weitzel) writes:
>
>Tracing the problem in "/usr/include/curses.h" reveals that "box()"
>was replaced by "border()" and "wborder()" which I don't find in my
>FM(%), but obviously these functions are the logical consequence of
>the fact that you really need more than two different border characters
>for nice boxes ("border()" is the "stdscr"-version of "wborder()").

	This isn't the only thing changed. One of my routines requires
	the wattrset() - window attribute setting routine. Upgrading to
	ISC's 3.2 compiler laster year, I discovered that some standout
	routines no longer worked. Buried in curses.h, I found something
	like:	
		#define wattrset	w32attrset

	Don't want to single ISC out, since I discovered the same thing
	when I upgraded to the SCO Xenix 2.3 compiler. Same result.

	None of the documentation mentioned the change. Solution: added
	to the source code:
		#undef wattrset