static char sccsid
[] = "@(#)cds224.c 1.1 (Berkeley) 1/13/86";
* conopn: establish dial-out connection through a Concord CDS 224.
* Returns descriptor open to tty for reading and writing.
* Negative values (-1...-7) denote errors in connmsg.
* Be sure to disconnect tty when done, via HUPCL or stty 0.
#define TRYS 5 /* number of trys */
cdsopn224(telno
, flds
, dev
)
int i
, ok
, er
= 0, delay
;
sprintf(dcname
, "/dev/%s", dev
->D_line
);
DEBUG(1, "timeout concord open\n", "");
logent("concord open", "TIMEOUT");
signal(SIGALRM
, alarmtr
);
fixline(dh
, dev
->D_speed
);
DEBUG(4, "calling %s -> ", telno
);
if (dochat(dev
, flds
, dh
)) {
logent(dcname
, "CHAT FAILED");
for(i
= 0; i
< TRYS
; ++i
) {
DEBUG(4, "wanted CDS >", CNULL
);
ok
= expect("CDS >", dh
);
DEBUG(4, "got %s\n", ok
? "?" : "that");
DEBUG(4, "wanted CDS >", CNULL
);
ok
= expect("CDS >", dh
);
DEBUG(4, "got %s\n", ok
? "?" : "that");
sprintf(tempbuf
,"D%s\r",telno
);
write(dh
, tempbuf
, strlen(tempbuf
));
DEBUG(4, "wanted DIALING ", CNULL
);
ok
= expect("DIALING ", dh
);
DEBUG(4, "got %s\n", ok
? "?" : "that");
sleep(10); /* give concord some time */
DEBUG(4, "wanted INITIATING " , CNULL
);
ok
= expect("INITIATING", dh
);
DEBUG(4, "got %s\n", ok
? "?" : "that");
DEBUG(4, "conDial failed\n", CNULL
);
DEBUG(4, "concord ok\n", CNULL
);