Annotation of 42BSD/usr.bin/tip/hunt.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.