# 2.11BSD#431 - /usr/src/usr.bin/uucp/aculib/va212.c

##### Functions

    va212cls          X
    va212opn          X

       1: #ifndef lint
       2: static char sccsid[] = "@(#)va212.c	4.2 (Berkeley) 6/23/85";
       3: #endif
       4:
       5: #include "../condevs.h"
       6:
       7: #ifdef VA212
       8: va212opn(telno, flds, dev)
       9: char *telno;
      10: char *flds[];
      11: struct Devices *dev;
      12: {
      13:     int dh = -1;
      14:     int i, ok, er = 0, delay;
      15:     extern errno;
      16:     char dcname[20];
      17:
      18:     sprintf(dcname, "/dev/%s", dev->D_line);
      19:     if (setjmp(Sjbuf)) {
      20:         DEBUG(1, "timeout va212 open\n", 0);
      21:         logent("va212 open", "TIMEOUT");
      22:         if (dh >= 0)
      23:             close(dh);
      24:         delock(dev->D_line);
      25:         return CF_NODEV;
      26:     }
      27:     signal(SIGALRM, alarmtr);
      28:     getnextfd();
      29:     alarm(10);
      30:     dh = open(dcname, 2);
      31:     alarm(0);
      32:
      33:     /* modem is open */
      34:     next_fd = -1;
      35:     if (dh < 0) {
      36:         DEBUG (4, errno == 4 ? "%s: no carrier\n" : "%s: can't open\n",
      37:         dcname);
      38:         delock(dev->D_line);
      39:         return errno == 4 ? CF_DIAL : CF_NODEV;
      40:     }
      41:     fixline(dh, dev->D_speed);
      42:
      43:     /* translate - to K for Vadic */
      44:     DEBUG(4, "calling %s -> ", telno);
      45:     delay = 0;
      46:     for (i = 0; i < strlen(telno); ++i) {
      47:         switch(telno[i]) {
      48:         case '=':   /* await dial tone */
      49:         case '-':   /* delay */
      50:         case '<':
      51:             telno[i] = 'K';
      52:             delay += 5;
      53:             break;
      54:         }
      55:     }
      56:     DEBUG(4, "%s\n", telno);
      57:     for(i = 0; i < TRYCALLS; ++i) { /* make TRYCALLS tries */
      58:         /* wake up Vadic */
      59:         sendthem("\005\\d", dh);
      60:         DEBUG(4, "wanted * ", CNULL);
      61:         ok = expect("*", dh);
      62:         DEBUG(4, "got %s\n", ok ? "?" : "that");
      63:         if (ok != 0)
      64:             continue;
      65:
      66:         sendthem("D\\d", dh);   /* "D" (enter number) command */
      67:         DEBUG(4, "wanted NUMBER? ", CNULL);
      68:         ok = expect("NUMBER?", dh);
      69:         if (ok == 0)
      70:             ok = expect("\n", dh);
      71:         DEBUG(4, "got %s\n", ok ? "?" : "that");
      72:         if (ok != 0)
      73:             continue;
      74:
      75:         /* send telno, send \r */
      76:         sendthem(telno, dh);
      77:         DEBUG(4, "wanted %s ", telno);
      78:         ok = expect(telno, dh);
      79:         if (ok == 0)
      80:             ok = expect("\n", dh);
      81:         DEBUG(4, "got %s\n", ok ? "?" : "that");
      82:         if (ok != 0)
      83:             continue;
      84:
      85:         sendthem("", dh); /* confirm number */
      86:         DEBUG(4, "wanted %s ", "DIALING...");
      87:         ok = expect("DIALING...", dh);
      88:         if (ok == 0) {
      89:             ok = expect("\n", dh);
      90:             DEBUG(4, "wanted ANSWER TONE", CNULL);
      91:             ok = expect("ANSWER TONE", dh);
      92:             if (ok == 0)
      93:                 ok = expect("\n", dh);
      94:         }
      95:         DEBUG(4, "got %s\n", ok ? "?" : "that");
      96:         if (ok == 0)
      97:             break;
      98:     }
      99:
     100:     if (ok == 0) {
     101:         DEBUG(4, "wanted ON LINE\\r\\n ", CNULL);
     102:         ok = expect("ON LINE\r\n", dh);
     103:         DEBUG(4, "got %s\n", ok ? "?" : "that");
     104:     }
     105:
     106:     if (ok != 0) {
     107:         sendthem("I\\d", dh);   /* back to idle */
     108:         if (dh > 2)
     109:             close(dh);
     110:         DEBUG(4, "vadDial failed\n", CNULL);
     111:         delock(dev->D_line);
     112:         return CF_DIAL;
     113:     }
     114:     DEBUG(4, "va212 ok\n", 0);
     115:     return dh;
     116: }
     117:
     118: va212cls(fd)
     119: {
     120:     if (fd > 0) {
     121:         close(fd);
     122:         sleep(5);
     123:         delock(devSel);
     124:     }
     125: }
     126: #endif VA212

#### Defined functions

va212cls defined in line 118; never used
va212opn defined in line 8; never used

#### Defined variables

sccsid defined in line 2; never used

Last modified: 1987-02-17 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1587 |