1 /*- 2 * Copyright (c) 1985, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)dk.c 8.1 (Berkeley) 06/06/93"; 10 #endif /* not lint */ 11 12 #include "condevs.h" 13 #ifdef DATAKIT 14 #include <dk.h> 15 #define DKTRIES 2 16 /*** 17 * dkopn(flds) make datakit connection 18 * 19 * return codes: 20 * >0 - file number - ok 21 * FAIL - failed 22 */ 23 dkopn(flds) 24 char *flds[]; 25 { 26 int dkphone; 27 register char *cp; 28 register ret, i; 29 30 if (setjmp(Sjbuf)) 31 return CF_DIAL; 32 33 signal(SIGALRM, alarmtr); 34 dkphone = 0; 35 cp = flds[F_PHONE]; 36 while(*cp) 37 dkphone = 10 * dkphone + (*cp++ - '0'); 38 DEBUG(4, "dkphone (%d) ", dkphone); 39 for (i = 0; i < DKTRIES; i++) { 40 getnextfd(); 41 ret = dkdial(D_SH, dkphone, 0); 42 next_fd = -1; 43 DEBUG(4, "dkdial (%d)\n", ret); 44 if (ret > -1) 45 break; 46 } 47 return ret; 48 } 49 #endif 50