1: /*
2: * Copyright (c) 1983 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: */
6:
7: #ifndef lint
8: static char sccsid[] = "@(#)hunt.c 5.2 (Berkeley) 4/23/87";
9: #endif not lint
10:
11: #include "tip.h"
12:
13: extern char *getremote();
14: extern char *rindex();
15:
16: static jmp_buf deadline;
17: static int deadfl;
18:
19: dead()
20: {
21:
22: deadfl = 1;
23: longjmp(deadline, 1);
24: }
25:
26: hunt(name)
27: char *name;
28: {
29: register char *cp;
30: int (*f)();
31:
32: f = signal(SIGALRM, dead);
33: while (cp = getremote(name)) {
34: deadfl = 0;
35: uucplock = rindex(cp, '/')+1;
36: if (mlock(uucplock) < 0) {
37: delock(uucplock);
38: continue;
39: }
40: /*
41: * Straight through call units, such as the BIZCOMP,
42: * VADIC and the DF, must indicate they're hardwired in
43: * order to get an open file descriptor placed in FD.
44: * Otherwise, as for a DN-11, the open will have to
45: * be done in the "open" routine.
46: */
47: if (!HW)
48: break;
49: if (setjmp(deadline) == 0) {
50: alarm(10);
51: FD = open(cp, O_RDWR);
52: }
53: alarm(0);
54: if (FD < 0) {
55: perror(cp);
56: deadfl = 1;
57: }
58: if (!deadfl) {
59: ioctl(FD, TIOCEXCL, 0);
60: ioctl(FD, TIOCHPCL, 0);
61: signal(SIGALRM, SIG_DFL);
62: return ((int)cp);
63: }
64: delock(uucplock);
65: }
66: signal(SIGALRM, f);
67: return (deadfl ? -1 : (int)cp);
68: }
Defined functions
dead
defined in line
19; used 1 times
hunt
defined in line
26; used 2 times
Defined variables
sccsid
defined in line
8;
never used