static char sccsid
[] = "@(#)vad.c 4.1 (Berkeley) %G%";
* vadopn: establish dial-out connection through a Racal-Vadic 3450.
* 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.
int i
, ok
, er
= 0, delay
;
sprintf(dcname
, "/dev/%s", dev
->D_line
);
DEBUG(1, "timeout vadic open\n", "");
logent("vadic 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
< strlen(telno
); ++i
) {
case '=': /* await dial tone */
for(i
= 0; i
< 5; ++i
) { /* make 5 tries */
DEBUG(4, "wanted * ", CNULL
);
DEBUG(4, "got %s\n", ok
? "?" : "that");
write(dh
, "D\r", 2); /* "D" (enter number) command */
DEBUG(4, "wanted NUMBER?\\r\\n ", CNULL
);
ok
= expect("NUMBER?\r\n", dh
);
DEBUG(4, "got %s\n", ok
? "?" : "that");
/* send telno, send \r */
write(dh
, telno
, strlen(telno
));
DEBUG(4, "wanted %s ", telno
);
DEBUG(4, "got %s\n", ok
? "?" : "that");
write(dh
, "\r", 1); /* confirm number */
DEBUG(4, "wanted DIALING: ", CNULL
);
ok
= expect("DIALING: ", dh
);
DEBUG(4, "got %s\n", ok
? "?" : "that");
sleep(10 + delay
); /* give vadic some time */
DEBUG(4, "wanted ON LINE\\r\\n ", CNULL
);
ok
= expect("ON LINE\r\n", dh
);
DEBUG(4, "got %s\n", ok
? "?" : "that");
DEBUG(4, "vadDial failed\n", CNULL
);
DEBUG(4, "vadic ok\n", CNULL
);