Open System Services Programmer's Guide
/* Read input from the terminal using READX. */
CC = READX(filenum, /* terminal file number */
buffer, /* input buffer */
sizeof(buffer), /* size of buffer */
&bytesread, /* bytes read */
);
/* Check for successful terminal read operation. */
if (_status_ne(CC)) {
fprintf(stderr, "READX from terminal failed: %s\n", terminal);
exit(1);
}
/* Write and read from the terminal in one operation. */
buffer[0] = ':'; buffer[1] = '\0';/* set up colon (:) prompt */
CC = WRITEREADX(filenum, /* terminal file number */
buffer, /* output string */
1, /* size of output string */
132, /* maximum buffer size */
&bytesread, /* actual bytes read */
);
if (_status_ne(CC)) {
fprintf(stderr, "WRITEREADX from terminal failed: %s\n", \
terminal);
exit(1);
}
buffer[bytesread] = 0;
printf("%s\n",buffer); /* print out data just read */
FILE_CLOSE_(filenum); /* close terminal file */
exit(0);
}
Using OSSTTY to Redirect Input and Output to Guardian Objects
The OSSTTY facility provides a way for OSS processes to interact with the Guardian environment.
OSSTTY enables OSS processes to redirect their standard input, standard output, and standard
error files to Guardian processes and, for standard output only, to Guardian EDIT files. Before the
implementation of OSSTTY, the OSS environment could be accessed only through a Telserv TELNET
session. Applications running in the OSS environment could interact with only one Guardian
process, namely Telserv. The OSSTTY process emulates a terminal, and eliminates the dependency
OSS applications have on TELNET sessions.
Figure 6 gives a high-level view of OSSTTY and its role as an intermediary between the OSS and
Guardian environments.
214 Managing I/O