HP 9000 Series 300 Tutorials Manual page 283

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: TWO
This program shows how to handle two terminals from a single program.
#include <curses.h>
#include <signal.h>
struct screen *me, *you;
struct screen *set_term();
FILE
*fd, *fdyou;
char
linebuf[512];
main(argc,argv)
{
char
**argv;
int
done
0 ;
int
c;
if (argc
!=
4) {
fprintf(stderr,"Usage: two othertty otherttytype inputfile\n");
exit(1) ;
}
fd
=
fopen(argv[3] ,"r");
fdyou
=
fopen(argv[1]
,"W+");
signal(SIGINT, done);
/* die gracefully */
me
=
newterm(getenv(ITERM"),stdout,stdin);
/* initialize my tty */
you
=
newterm(argv[2] ,fdyou,fdyou) ;
/* Initialize his/her terminal*/
set_term(me);
noechoO;
cbreakO;
nonlO;
nodelay(stdscr,TRUE);
set_term(you) ;
noechoO;
cbreakO;
nonlO;
nodelay(stdscr,TRUE);
/* Set modes for my terminal */
/* turn off tty echo */
/* enter cbreak mode */
/* Allow linefeed */
/* No hang on input */
/* Dump first screen full on my terminal */
Program Operation
3-19

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Hp 9000 series 800

Table of Contents