/*
 * 5799-WZQ (C) COPYRIGHT = NONE
 * LICENSED MATERIALS - PROPERTY OF IBM
 */
/* $Header:dk.c 12.0$ */
/* $ACIS:dk.c 12.0$ */
/* $Source: /ibm/acis/usr/src/usr.bin/uucp/aculib/RCS/dk.c,v $ */

#ifndef lint
static char *rcsid = "$Header:dk.c 12.0$";
#endif

#ifndef lint
static char sccsid[] = "@(#)dk.c	4.1 (Berkeley) 1/22/85";
#endif

#include "../condevs.h"
#ifdef DATAKIT
#include <dk.h>
#define DKTRIES 2
/***
 *	dkopn(flds)	make datakit connection
 *
 *	return codes:
 *		>0 - file number - ok
 *		FAIL - failed
 */
dkopn(flds)
char *flds[];
{
	int dkphone;
	register char *cp;
	register ret, i;

	if (setjmp(Sjbuf))
		return CF_DIAL;

	signal(SIGALRM, alarmtr);
	dkphone = 0;
	cp = flds[F_PHONE];
	while(*cp)
		dkphone = 10 * dkphone + (*cp++ - '0');
	DEBUG(4, "dkphone (%d) ", dkphone);
	for (i = 0; i < DKTRIES; i++) {
		getnextfd();
		ret = dkdial(D_SH, dkphone, 0);
		next_fd = -1;
		DEBUG(4, "dkdial (%d)\n", ret);
		if (ret > -1)
			break;
	}
	return ret;
}
#endif
