Open System Services Programmer's Guide
Examples of OSSTTY Usage
Following are some typical examples of OSSTTY usage.
Redirecting Input From a Guardian Process to an OSS Process
In this example, OSSTTY is used to direct input from $vhs (Guardian virtual hometerm subsystem)
to an ftp client running in OSS.
TACL> run osstty /name $tty, in $vhs, nowait/
TACL> osh
$/usr/ucb/ftp </G/tty/#stdin
OSSTTY is started with its standard input set to $vhs. In the OSS environment, an ftp client is
started, with redirection used to receive input from /G/tty/#stdin. Input received through $vhs
is received by OSSTTY and redirected to /G/tty/#stdin. The nowait parameter is used to
return control to the user immediately after OSSTTY is initiated
The technique illustrated in this example could be used to create an OSS application that receives
input interactively from the Guardian environment (through $vhs).
Redirecting Output From OSS to a Guardian EDIT file
The following example illustrates redirecting output from an OSS command to a Guardian EDIT
file.
TACL> run osstty /name $tty, out editfil, nowait/
TACL> osh -c "ls > /G/tty/#stdout"
The run command starts an OSSTTY process named $tty, with its standard output set to editfil
(assume editfil is a Guardian EDIT file). The osh command starts an OSS shell and runs an
ls command that redirects its output to /G/tty/#stdout/. OSSTTY receives the output and
redirects it to its standard output, which is set to EDITFIL.
Redirecting Output From OSS to a Telserv Terminal
In the following example, output from an ls command is redirected, through OSSTTY, to a Telserv
terminal named $ztn0.#ptycasu1.
TACL> run osstty /name $tty, out $ztn0.#ptycasu1, nowait/
-noserver -idletime 0
TACL> osh
$ ls -l > /G/tty/#stdout
The -noserver and -idletime parameters cause OSSTTY to terminate after the ls command
completes.
Executing a Shell Script and Redirecting Output to a Guardian Process
The following example executes an OSS shell script and uses OSSTTY to direct the output to a
Guardian process. The Guardian process is a logger process that sends all input data from its
$RECEIVE file to an EDIT file.
The following command starts the shell script /home/stu01/user_report with output redirected
to the standard output file.
TACL> osh -c "/home/stu01/user_report" > /G/tty/#stdout
The following command starts the Guardian logger process, named logger, with logfile as its output
file.
TACL> run logger /name $log/ logfile
The following command starts OSSTTY, with the logger process specified for the out and term
parameters. OSSTTY will redirect its standard output (/G/tty/#stdout) and standard error
(/G/tty/#stderr) to the logger process.
TACL> run osstty /name $tty, out $log, term $log, nowait/
Using OSSTTY to Redirect Input and Output to Guardian Objects 217