flint@gistdev.gist.com (Flint Pellett) (08/24/90)
/*
** I believe that I "may" have found a bug in the AT&T console driver,
** or something related.
**
** Here is my sample curses program that demonstrates the problem.
** WARNING WARNING: executing this program will leave your terminal
** in the alternate charset when you are returned to the shell: even tho
** it will all look like gibberish, you ought to be able to get back to
** normal with a "tput rmacs" or a "tput init", but I can't make any
** guarantees about your system: be prepared to reboot. This behavior is
** exhibited on an AT&T 6386 WGS running AT&T UNIX System V R3.2.2.
**
** The program merely tries to draw two vertical lines 6 columns apart.
** The problem is, because both the A_ALTCHARSET bit and the A_BOLD bit
** are on to plot the ACS_VLINE chars, it doesn't get reset back out of
** altcharset mode after plotting the first VLINE char: so it plots
** 0xA0 (An a with an accent quote above it) between the vertical lines
** when it echoes spaces to position to the 2nd column, and then when it
** exits the program it leaves you in the alternate charset.
*/
#include <curses.h>
main()
{
initscr();
attrset(A_BOLD); /* The KEY to the problem */
mvaddch( 11, 10, ACS_VLINE ); /* row 11, col 10 */
mvaddch( 11, 15, ACS_VLINE ); /* row 11, col 15 */
refresh();
endwin();
}
/***
Here is the od -c of the trapped output to show you what it is doing:
0000000 033 [ 0 m 033 [ 2 J 033 [ H 033 [ 1 2 ;
0000020 1 1 H 033 [ 1 2 m 033 [ 1 m 3 033 [ 0
0000040 m 033 [ 1 2 m 033 [ 1 m 3 033
0000060 [ 0 m 033 [ 2 5 ; 0 1 H 033 [ 0 m \0
0000077
You can see on line 2 that it echoed an \E[12m for alternate chars,
then \E[1m (bold) then the "3" for the vertical line. It then sent
the sgr0 string \E[0m which is supposed to mean "reset all attributes"
but which only reset the bold attribute. When I changed my terminfo
to have sgr0=\E[0m\E[10m (ie, I added an explicit rmacs to the sgr0)
it worked properly. So: if \E[0m is supposed to include "alternate
charset" as one of "all attributes", then there is a bug in it. I
assume that \E[0m is supposed to do that, because if you do not have
the bold attribute selected, then \E[0 _will_ turn off the alternate
chars attribute properly: it is only when bold is also on that it
doesn't get the job done.
***/
--
Flint Pellett, Global Information Systems Technology, Inc.
1800 Woodfield Drive, Savoy, IL 61874 (217) 352-1165
uunet!gistdev!flint or flint@gistdev.gist.com