Open System Services Programmer's Guide
FILE_PURGE_((char *)file_name,
(short)strlen(file_name));
error = OPENEDIT_((char *)file_name,
(short)strlen(file_name),
&edit_fd,
2/*Write Only*/,
0/* shared*/,
0,/*nowait depth*/
15);
if (error) {
printf("Unable to Created EDIT File\n");
exit(0);
}
}
short tty_info_fnum(short fd) {
short error;
(void) FILE_GETINFO_(fd, &error );
return error;
}
/* Open $RECEIVE in waited manner for interprocess
communication */
void dol_RECEIVE_opener(void) {
short error = 0;
if (( rcv_fd = tty_open_file ("$RECEIVE", 8, 0,
O_WAITED_OPEN,
0/*Shared*/,
0/*Read Write*/,
RECV_QMAX, &error)) < 0 ) {
printf("Can't open $RECEIVE\n");
}
}
short tty_open_file (char *name, short name_len, short nwio, short nwopen,
short excl, short access, long sync, short *error)
{
char fname [FNAME32_LEN + 1];
short fd;
short options = 0;
strncpy (fname, name, name_len);
fname[name_len]='\0';
*error = FILE_OPEN_ (fname, name_len,
&fd, access, excl, nwio, (short) sync,
options);
return fd; /* fd = -1 if FILE_OPEN failed */
}
Running an Interactive OSS Session From a TACL Macro
This example shows a method for using OSSTTY to run multiple interactive OSS sessions from the
Guardian environment. The example behaves similarly to the the Guardian Define Process facility
and the TACL #INLINE facility. The example consists of a TACL program that starts an OSS shell,
starts an OSSTTY process, submits OSS commands to the shell, and uses OSSTTY to redirect output,
prompts, and error messages to the Guardian environment.
The program takes into account the fact that OSS shell commands issue input prompts through the
standard error file. The program redirects the shell’s standard error file to the standard output, then
tests each line of output to determine whether it is a prompt or some other message.
Using OSSTTY to Redirect Input and Output to Guardian Objects 221