148651Sbostic /*-
2*62384Sbostic * Copyright (c) 1985, 1993
3*62384Sbostic * The Regents of the University of California. All rights reserved.
448651Sbostic *
548651Sbostic * %sccs.include.proprietary.c%
648651Sbostic */
748651Sbostic
817778Sralph #ifndef lint
9*62384Sbostic static char sccsid[] = "@(#)pnet.c 8.1 (Berkeley) 06/06/93";
1048651Sbostic #endif /* not lint */
1117778Sralph
1246875Sbostic #include "condevs.h"
1317778Sralph #ifdef PNET
1417778Sralph
1517778Sralph /***
1617778Sralph * pnetopn(flds)
1717778Sralph *
1817778Sralph * call remote machine via Purdue network
1917778Sralph * use dial string as host name, speed as socket number
2017778Sralph * - Steve Bellovin
2117778Sralph */
pnetopn(flds)2217778Sralph pnetopn(flds)
2317778Sralph char *flds[];
2417778Sralph {
2517778Sralph int fd;
2617778Sralph int socket;
2717778Sralph register char *cp;
2817778Sralph
2917778Sralph fd = pnetfile();
3017778Sralph DEBUG(4, "pnet fd - %d\n", fd);
3117778Sralph if (fd < 0) {
3217778Sralph logent("AVAILABLE DEVICE", "NO");
3317778Sralph return CF_NODEV;
3417778Sralph }
3517778Sralph socket = 0;
3617778Sralph for (cp = flds[F_CLASS]; *cp; cp++)
3717778Sralph socket = 10*socket + (*cp - '0');
3817778Sralph DEBUG(4, "socket - %d\n", socket);
3917778Sralph if (setjmp(Sjbuf)) {
4017778Sralph DEBUG(4, "pnet timeout - %s\n", flds[F_PHONE]);
4117778Sralph return CF_DIAL;
4217778Sralph }
4317778Sralph signal(SIGALRM, alarmtr);
4417778Sralph DEBUG(4, "host - %s\n", flds[F_PHONE]);
4517778Sralph alarm(15);
4617778Sralph if (pnetscon(fd, flds[F_PHONE], socket) < 0) {
4717778Sralph DEBUG(4, "pnet connect failed - %s\n", flds[F_PHONE]);
4823699Sbloom alarm(0);
4917778Sralph return CF_DIAL;
5017778Sralph }
5117778Sralph alarm(0);
5217778Sralph return fd;
5317778Sralph }
5417778Sralph #endif PNET
55