Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)
Example 1 runossp.c Sample Code
/*
runossp.c - use the Guardian C runtime routine system() within
a Guardian program invoked from the TACL command interpreter to run
an OSS "command string". The command string may be any valid OSS shell
command, OSS utility name, or script file pathname
and can include parameters to be processed by the named command,
utility or script.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cextdecs.h(PROCESSHANDLE_NULLIT_, PROCESS_GETINFO_)>
int main(int argc, char *argv[]) {
short myprochandle[10]; /* process handle */
char myterm[64]; /* home terminal */
short mytermlen; /* length of terminal name */
char command[255]; /* command string */
int i=2;
if(argc < 2) {
printf("Usage: runossp \"command string\"\n");
exit (1);
}
/* Get the home terminal name */
PROCESSHANDLE_NULLIT_(myprochandle);
PROCESS_GETINFO_(
myprochandle,
/* filename */,
/* filenamemaxlen */,
/* filenamelen */,
/* pri */,
/* mom */,
myterm, /* home terminal name */
(short)(sizeof(myterm)-1),
&mytermlen );
myterm[mytermlen] = '\0';
sprintf(command, "OSH /IN %s, OUT %s/ -c \"%s",
myterm, myterm, argv[1]);
while(i < argc) {
strcat(command, " "); /* space between arguments */
strcat(command, argv[i++]);
}
strcat(command, "\""); /* string command terminator */
system(command); /* execute OSS command */
exit (0);
}
Using the Guardian LISTNER Program
In the Guardian environment, a server program can be started by a system operator or by the
LISTNER process. The LISTNER process functions as a super server for application servers. The
LISTNER program works in much the same way as the inetd demon does in UNIX systems or in
Open System Services and is used to activate Internet services. To use the LISTNER, the PORTCONF
file must be configured for the application servers to be started when requests are received on
specific port numbers.
OSS server programs can be initiated from the OSS shell either in the foreground or in the
background. They cannot be activated directly from the Guardian LISTNER program, but they can
be activated by the LISTNER using an intermediate Guardian server program. A new Guardian
154 Migrating Guardian Applications to the OSS Environment