Curses is broken. Don't believe it? Try this...

Augustine Cano afc at shibaya.lonestar.org
Tue Apr 2 09:14:35 AEST 1991


Ah! the curses of curses...  I've been trying to exorcise character
attributes, but my Cabalistic code is not powerful enough.  It is
possible to display at least BOLD characters with a plain C program,
as shown below.

The following attributes are defined in /usr/include/curses.h:

/* Various video attributes */
#define A_STANDOUT	0000200
#define	_STANDOUT	A_STANDOUT    /* for compatibility with old curses */
#define A_UNDERLINE	0000400
#define A_REVERSE	0001000
#define A_BLINK		0002000
#define A_DIM		0004000
#define A_BOLD		0010000
#define A_ALTCHARSET	0100000

The following program attempts to display something in all of these
attributes, with varying results:

/************************************************************************/

#include <curses.h>

main()

{

initscr();

attrset (A_NORMAL);
mvprintw (8,5, "NORMAL");
attrset (A_STANDOUT);		/* Doesn't work: displayed in REVERSE	*/
mvprintw (10,60, "STANDOUT");
attrset (A_UNDERLINE);		/* OK					*/
mvprintw (12,20, "UNDERLINE");
attrset (A_REVERSE);		/* OK					*/
mvprintw (14,30, "REVERSE");
attrset (A_BLINK);		/* Doesn't work: displayed in REVERSE	*/
mvprintw (16,40, "BLINK");
attrset (A_DIM);		/* OK					*/
mvprintw (18,10, "DIM");
attrset (A_BOLD);		/* Doesn't work: displayed in REVERSE	*/
mvprintw (20,5, "BOLD");

attrset (A_NORMAL);

refresh();
endwin();
exit(0);
}

/************************************************************************/

I don't know how STANDOUT should appear, but BOLD is significant because
it works correctly in the non-curses program below:

/************************************************************************/

#include <stdio.h>

main()

{

/*
 *  These escape sequences are documented in the Communications Management
 *  manual, page A10.
 */

printf("NORMAL\n");
printf("\n%c[%dm%s%c[0m\n",27,1,"BOLD IS OK",27);
printf("\n%c[%dm%s%c[0m\n",27,2,"DIM IS OK",27);
printf("\n%c[%dm%s%c[0m\n",27,4,"UNDERLINE IS OK",27);
printf("\n%c[%dm%s%c[0m\n",27,7,"REVERSE IS OK",27);
printf("\n%c[%dm%s%c[0m\n",27,8,"CONCEALED DOESN'T WORK",27);

/*
 *  These are not documented in the Communications Management manual.
 *  Only the last one works.
 */

printf("\n%c[%dm%s%c[0m\n",27,3,"NOTHING HAPPENS",27);
printf("\n%c[%dm%s%c[0m\n",27,5,"NOTHING HAPPENS",27);
printf("\n%c[%dm%s%c[0m\n",27,6,"NOTHING HAPPENS",27);
printf("\n%c[%dm%s%c[0m\n",27,9,"CROSSED OUT",27);

exit(0);
}

/************************************************************************/

I could believe that it is impossible to do blinking in the unix pc, but
is there a way to display text in STANDOUT and BOLD attributes using
curses?

BTW, this is 3.51m with 3.51 Foundation set and 3.51 Develpment set.

-- 
Augustine Cano		INTERNET: afc at shibaya.lonestar.org
			UUCP:     ...!{ernest,egsner}!shibaya!afc



More information about the Comp.sys.3b1 mailing list