xref: /csrg-svn/usr.bin/uucp/libacu/dk.c (revision 62384)
148651Sbostic /*-
2*62384Sbostic  * Copyright (c) 1985, 1993
3*62384Sbostic  *	The Regents of the University of California.  All rights reserved.
448651Sbostic  *
548651Sbostic  * %sccs.include.proprietary.c%
648651Sbostic  */
748651Sbostic 
817772Sralph #ifndef lint
9*62384Sbostic static char sccsid[] = "@(#)dk.c	8.1 (Berkeley) 06/06/93";
1048651Sbostic #endif /* not lint */
1117772Sralph 
1246875Sbostic #include "condevs.h"
1317772Sralph #ifdef DATAKIT
1417772Sralph #include <dk.h>
1517772Sralph #define DKTRIES 2
1617772Sralph /***
1717772Sralph  *	dkopn(flds)	make datakit connection
1817772Sralph  *
1917772Sralph  *	return codes:
2017772Sralph  *		>0 - file number - ok
2117772Sralph  *		FAIL - failed
2217772Sralph  */
dkopn(flds)2317772Sralph dkopn(flds)
2417772Sralph char *flds[];
2517772Sralph {
2617772Sralph 	int dkphone;
2717772Sralph 	register char *cp;
2817772Sralph 	register ret, i;
2917772Sralph 
3017772Sralph 	if (setjmp(Sjbuf))
3117772Sralph 		return CF_DIAL;
3217772Sralph 
3317772Sralph 	signal(SIGALRM, alarmtr);
3417772Sralph 	dkphone = 0;
3517772Sralph 	cp = flds[F_PHONE];
3617772Sralph 	while(*cp)
3717772Sralph 		dkphone = 10 * dkphone + (*cp++ - '0');
3817772Sralph 	DEBUG(4, "dkphone (%d) ", dkphone);
3917772Sralph 	for (i = 0; i < DKTRIES; i++) {
4017772Sralph 		getnextfd();
4117772Sralph 		ret = dkdial(D_SH, dkphone, 0);
4217772Sralph 		next_fd = -1;
4317772Sralph 		DEBUG(4, "dkdial (%d)\n", ret);
4417772Sralph 		if (ret > -1)
4517772Sralph 			break;
4617772Sralph 	}
4717772Sralph 	return ret;
4817772Sralph }
4917772Sralph #endif
50