1*3690Sroot /* df.c 4.1 81/05/09 */ 2*3690Sroot /* 3*3690Sroot * Dial the DF02-AC 4*3690Sroot */ 5*3690Sroot 6*3690Sroot #include "tip.h" 7*3690Sroot #if DF02 8*3690Sroot #include <setjmp.h> 9*3690Sroot 10*3690Sroot static jmp_buf Sjbuf; 11*3690Sroot static timeout(); 12*3690Sroot 13*3690Sroot df_dialer(num, acu) 14*3690Sroot char *num, *acu; 15*3690Sroot { 16*3690Sroot register int f = FD; 17*3690Sroot int c; 18*3690Sroot 19*3690Sroot ioctl(f, TIOCHPCL, 0); /* make sure it hangs up when done */ 20*3690Sroot if (setjmp(Sjbuf)) { 21*3690Sroot printf("connection timed out\r\n"); 22*3690Sroot df_disconnect(); 23*3690Sroot return(0); 24*3690Sroot } 25*3690Sroot if (boolean(value(VERBOSE))) 26*3690Sroot printf("\ndialing..."); 27*3690Sroot fflush(stdout); 28*3690Sroot signal(SIGALRM, timeout); 29*3690Sroot alarm(5 * strlen(num) + 10); 30*3690Sroot ioctl(f, TIOCFLUSH, 0); 31*3690Sroot write(f, "\001", 1); 32*3690Sroot sleep(0); /* this must waste 70 ms. */ 33*3690Sroot write(f, "\002", 1); 34*3690Sroot write(f, num, strlen(num)); 35*3690Sroot c = 0; 36*3690Sroot read(f, (char *)&c, 1); 37*3690Sroot return(c == 'A'); 38*3690Sroot } 39*3690Sroot 40*3690Sroot 41*3690Sroot df_disconnect() 42*3690Sroot { 43*3690Sroot write(FD, "\001", 1); 44*3690Sroot sleep(1); 45*3690Sroot ioctl(FD, TIOCFLUSH, 0); 46*3690Sroot } 47*3690Sroot 48*3690Sroot 49*3690Sroot df_abort() 50*3690Sroot { 51*3690Sroot write(FD, "\001", 1); 52*3690Sroot sleep(1); 53*3690Sroot ioctl(FD, TIOCFLUSH, 0); 54*3690Sroot } 55*3690Sroot 56*3690Sroot 57*3690Sroot static 58*3690Sroot timeout() 59*3690Sroot { 60*3690Sroot longjmp(Sjbuf, 1); 61*3690Sroot } 62*3690Sroot #endif 63