HP 9000 Series 300 Tutorials Manual page 286

Device i/o and user interfacing hp-ux concepts and tutorials
Hide thumbs Also See for HP 9000 Series 300:
Table of Contents

Advertisement

Example Program: TERMHL
This program is equivalent to the earlier example program HIGHLIGHT, but uses
terminfo routines instead.
#include <curses.h>
#include <term.h>
int
ulmode
=
0;
/* Currently underlining */
main (argc, argv)
{
char
**argv;
FILE
*fd;
int
c,c2;
int
outchO;
i f
(argc > 2) {
fprintf(stderr, "Usage: termhl [file]\n");
exit(1);
}
i f
(argc
==
2) {
fd
=
fopen(argv[1] ,"r");
if (fd
==
NULL) {
perror(argv[1]) ;
exit(2);
}
} else {
fd
=
stdin;
}
setupterm(O, 1,0) ;
for (;;) {
c
=
getc(fd);
if (c
==
EOF)
break;
i f (c
== '\\,) {
c2
=
getc(fd);
switch(c2) {
case 'B':
tputs(enter_bold_mode,1,outch);
continue;
3-22
Program Operation

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Hp 9000 series 800

Table of Contents