Curses SysV R2 -> SysV R3: box() function

Martin Weitzel martin at mwtech.UUCP
Tue Jul 3 19:38:59 AEST 1990


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 at mwtech.UUCP, voice: 49-(0)6151-6 56 83



More information about the Comp.unix.questions mailing list