Open System Services Porting Guide (G06.24+, H06.03+)

Table Of Contents
Interoperating Between Programming Environments
Open System Services Porting Guide520573-006
5-13
Terminal I/O
Terminal I/O
The only terminals supported in the OSS environment are a Telserv window and the
three OSSTTY windows: #stdin, #stdout, and #stderr. Terminal I/O through a
Telserv window is the same as that for a UNIX network terminal. OSS also supports
local terminals through OSSTTY, although OSSTTY has the look and feel of a remote
terminal. OSS terminal I/O functions operate only on the terminal device /dev/tty.
The functions cfsetispeed() cfsetospeed() have no effect on the network
terminals (they affect only local terminals). The function tcsetattr affects both the
Telserv and OSSTTY terminals.
The only way to access the OSS environment interactively is through an OSSTTY
window or through a Telserv virtual terminal, or window, with VT100 emulation. The
Open System Services Programmer’s Guide discusses accessing terminals from the
OSS environment, including details on static and dynamic windows, terminal
parameters, and control characters, where managing I/O is discussed. There is also a
discussion of the OSSTTY facility.
The OSS terminal interface is described in detail in the termios(4) and tty(7)
reference pages, either online or in the Open System Services System Calls
Reference Manual.
Printer I/O
The OSS API has no function that accesses printers or spoolers directly. To print from
an OSS program or get information about a print job, you can use the popen()
function to call the lp or lpstat utility. For information about these utilities, refer to
the lp(1) and lpstat(1) reference pages either online or in the Open System
Services Shell and Utilities Reference Manual, or refer to the Open System Services
User’s Guide.
An alternative is to write OSS files and send output directly to a printer or to the
Guardian spooler using the Guardian API, and take advantage of the spooler features.
For example, your program can examine the queues of available printers and move a
job to a printer whose queue becomes unexpectedly shorter because of a job
cancellation, or away from a printer that is experiencing delays. You can also access
spoolers that are on other systems than the file you want to print.
You can send an OSS file to the spooler and control the spooler from an OSS program
using Guardian spooler procedures. The printer is opened using FILE_OPEN_; then,
SPOOLSTART is called to establish a level-3 spooling session. The Open System
Services Programmer’s Guide contains an example of using Guardian spooler
procedures, in the discussion about managing I/O.
Mixed-Module Programming
In general, a program that runs as an OSS process is composed of modules compiled
for the OSS environment (OSS modules). Likewise, a program that runs as a Guardian
process is composed of modules compiled for the Guardian environment (Guardian