NIO CommKit Host Interface Installation and System Administration Manual

F-6
Example Programs
Introduction
}
exit(0);
}
connect(transport, system, service)
char *transport;
char *system;
char *service;
{
int fd;
struct t_call *sndcall;
struct t_bind *bndcall;
struct t_discon *discon;
int n;
char nlps[256];
if ((fd = t_open(transport, O_RDWR, NULL)) < 0) {
t_error("t_open() failed");
return (-1);
}
if ((bndcall = (struct t_bind*) t_alloc(fd, T_CALL, T_ADDR))
== NULL) {
t_error("t_alloc() failed");
return (-1);
}
bndcall->addr.buf = system;
bndcall->addr.len = strlen(system);
bndcall->qlen = 0;
if (t_bind(fd, bndcall, NULL) < 0) {
t_error("t_bind() failed");
return (-1);
}
if ((sndcall = (struct t_call*) t_alloc(fd, T_CALL, T_ADDR))
== NULL) {
t_error("t_alloc() failed");
return (-1);
}
sndcall->addr.buf = system;
sndcall->addr.len = strlen(system);
if (t_connect(fd, sndcall, NULL) < 0) {
t_error("t_connect() failed");
return (-1);
}
if (ioctl(fd, I_PUSH, "tirdwr") < 0) {
fprintf(stderr, "push of tirdwr failed\n");
return (-1);
}
(continues next page)