1: #ifndef lint
   2: static char sccsid[] = "@(#)vent.c	4.2 (Berkeley) 10/10/85";
   3: #endif
   4: 
   5: #include "../condevs.h"
   6: #ifdef  VENTEL
   7: 
   8: ventopn(telno, flds, dev)
   9: char *flds[], *telno;
  10: struct Devices *dev;
  11: {
  12:     int dh;
  13:     int i, ok = -1;
  14:     char dcname[20];
  15: 
  16:     sprintf(dcname, "/dev/%s", dev->D_line);
  17:     if (setjmp(Sjbuf)) {
  18:         DEBUG(1, "timeout ventel open\n", "");
  19:         logent("ventel open", "TIMEOUT");
  20:         if (dh >= 0)
  21:             close(dh);
  22:         delock(dev->D_line);
  23:         return CF_NODEV;
  24:     }
  25:     signal(SIGALRM, alarmtr);
  26:     getnextfd();
  27:     alarm(10);
  28:     dh = open(dcname, 2);
  29:     next_fd = -1;
  30:     alarm(0);
  31:     if (dh < 0) {
  32:         DEBUG(4,"%s\n", errno == 4 ? "no carrier" : "can't open modem");
  33:         delock(dev->D_line);
  34:         return errno == 4 ? CF_DIAL : CF_NODEV;
  35:     }
  36: 
  37:     /* modem is open */
  38:     fixline(dh, dev->D_speed);
  39: 
  40:     /* translate - to % and = to & for VenTel */
  41:     DEBUG(4, "calling %s -> ", telno);
  42:     for (i = 0; i < strlen(telno); ++i) {
  43:         switch(telno[i]) {
  44:         case '-':   /* delay */
  45:             telno[i] = '%';
  46:             break;
  47:         case '=':   /* await dial tone */
  48:             telno[i] = '&';
  49:             break;
  50:         case '<':
  51:             telno[i] = '%';
  52:             break;
  53:         }
  54:     }
  55:     DEBUG(4, "%s\n", telno);
  56:     sleep(1);
  57:     for(i = 0; i < 5; ++i) {    /* make up to 5 tries */
  58:         slowrite(dh, "\r\r");/* awake, thou lowly VenTel! */
  59: 
  60:         DEBUG(4, "wanted %s ", "$");
  61:         ok = expect("$", dh);
  62:         DEBUG(4, "got %s\n", ok ? "?" : "that");
  63:         if (ok != 0)
  64:             continue;
  65:         slowrite(dh, "K");  /* "K" (enter number) command */
  66:         DEBUG(4, "wanted %s ", "DIAL: ");
  67:         ok = expect("DIAL: ", dh);
  68:         DEBUG(4, "got %s\n", ok ? "?" : "that");
  69:         if (ok == 0)
  70:             break;
  71:     }
  72: 
  73:     if (ok == 0) {
  74:         slowrite(dh, telno); /* send telno, send \r */
  75:         slowrite(dh, "\r");
  76:         DEBUG(4, "wanted %s ", "ONLINE");
  77:         ok = expect("ONLINE!", dh);
  78:         DEBUG(4, "got %s\n", ok ? "?" : "that");
  79:     }
  80:     if (ok != 0) {
  81:         if (dh > 2)
  82:             close(dh);
  83:         DEBUG(4, "venDial failed\n", "");
  84:         return CF_DIAL;
  85:     }
  86:     else
  87:         DEBUG(4, "venDial ok\n", "");
  88:     return dh;
  89: }
  90: 
  91: ventcls(fd)
  92: int fd;
  93: {
  94:     if (fd > 0) {
  95:         close(fd);
  96:         sleep(5);
  97:         delock(devSel);
  98:     }
  99: }
 100: #endif VENTEL

Defined functions

ventcls defined in line 91; never used
ventopn defined in line 8; never used

Defined variables

sccsid defined in line 2; never used
Last modified: 1986-01-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1103
Valid CSS Valid XHTML 1.0 Strict