1 /* hunt.c 4.5 81/11/29 */ 2 #include "tip.h" 3 4 #define RD 04 5 6 extern char *getremote(); 7 extern char *rindex(); 8 9 int deadfl; 10 11 dead() 12 { 13 deadfl = 1; 14 } 15 16 hunt(name) 17 char *name; 18 { 19 register char *cp; 20 21 deadfl = 0; 22 signal(SIGALRM, dead); 23 while (cp = getremote(name)) { 24 if (access(cp, RD)) 25 continue; 26 uucplock = rindex(cp, '/')+1; 27 if (mlock(uucplock) < 0) { 28 delock(uucplock); 29 continue; 30 } 31 /* 32 * Straight through call units, such as the BIZCOMP 33 * and the DF, must indicate they're hardwired in 34 * order to get an open file descriptor placed in FD. 35 * Otherwise, as for a DN-11, the open will have to 36 * be done in the "open" routine. 37 */ 38 if (!HW) 39 break; 40 alarm(10); 41 if ((FD = open(cp, 2)) >= 0){ 42 alarm(0); 43 if (!deadfl) { 44 ioctl(FD, TIOCEXCL, 0); 45 signal(SIGALRM, SIG_DFL); 46 return ((int)cp); 47 } 48 } 49 alarm(0); 50 signal(SIGALRM, dead); 51 delock(uucplock); 52 } 53 signal(SIGALRM, SIG_DFL); 54 return (deadfl ? -1 : (int)cp); 55 } 56