# 2.11BSD#431 - /usr/src/usr.bin/tip/aculib/df.c

##### Functions

    df02_dialer       X
    df03_dialer       X
    df_abort          X
    df_dialer         X
    df_disconnect     X

       1: /*
       2:  * Copyright (c) 1983 Regents of the University of California.
       3:  * All rights reserved.  The Berkeley software License Agreement
       4:  * specifies the terms and conditions for redistribution.
       5:  */
       6:
       7: #ifndef lint
       8: static char sccsid[] = "@(#)df.c	5.1 (Berkeley) 6/6/85";
       9: #endif not lint
      10:
      11: /*
      12:  * Dial the DF02-AC or DF03-AC
      13:  */
      14:
      15: #include "tip.h"
      16:
      17: static jmp_buf Sjbuf;
      18: static timeout();
      19:
      20: df02_dialer(num, acu)
      21:     char *num, *acu;
      22: {
      23:
      24:     return (df_dialer(num, acu, 0));
      25: }
      26:
      27: df03_dialer(num, acu)
      28:     char *num, *acu;
      29: {
      30:
      31:     return (df_dialer(num, acu, 1));
      32: }
      33:
      34: df_dialer(num, acu, df03)
      35:     char *num, *acu;
      36:     int df03;
      37: {
      38:     register int f = FD;
      39:     struct sgttyb buf;
      40:     int speed = 0, rw = 2;
      41:     char c = '\0';
      42:
      43:     ioctl(f, TIOCHPCL, 0);      /* make sure it hangs up when done */
      44:     if (setjmp(Sjbuf)) {
      45:         printf("connection timed out\r\n");
      46:         df_disconnect();
      47:         return (0);
      48:     }
      49:     if (boolean(value(VERBOSE)))
      50:         printf("\ndialing...");
      51:     fflush(stdout);
      52: #ifdef TIOCMSET
      53:     if (df03) {
      54:         int st = TIOCM_ST;  /* secondary Transmit flag */
      55:
      56:         ioctl(f, TIOCGETP, &buf);
      57:         if (buf.sg_ospeed != B1200) {   /* must dial at 1200 baud */
      58:             speed = buf.sg_ospeed;
      59:             buf.sg_ospeed = buf.sg_ispeed = B1200;
      60:             ioctl(f, TIOCSETP, &buf);
      61:             ioctl(f, TIOCMBIC, &st); /* clear ST for 300 baud */
      62:         } else
      63:             ioctl(f, TIOCMBIS, &st); /* set ST for 1200 baud */
      64:     }
      65: #endif
      66:     signal(SIGALRM, timeout);
      67:     alarm(5 * strlen(num) + 10);
      68:     ioctl(f, TIOCFLUSH, &rw);
      69:     write(f, "\001", 1);
      70:     sleep(1);
      71:     write(f, "\002", 1);
      72:     write(f, num, strlen(num));
      73:     read(f, &c, 1);
      74: #ifdef TIOCMSET
      75:     if (df03 && speed) {
      76:         buf.sg_ispeed = buf.sg_ospeed = speed;
      77:         ioctl(f, TIOCSETP, &buf);
      78:     }
      79: #endif
      80:     return (c == 'A');
      81: }
      82:
      83: df_disconnect()
      84: {
      85:     int rw = 2;
      86:
      87:     write(FD, "\001", 1);
      88:     sleep(1);
      89:     ioctl(FD, TIOCFLUSH, &rw);
      90: }
      91:
      92:
      93: df_abort()
      94: {
      95:
      96:     df_disconnect();
      97: }
      98:
      99:
     100: static
     101: timeout()
     102: {
     103:
     104:     longjmp(Sjbuf, 1);
     105: }

#### Defined functions

df02_dialer defined in line 20; never used
df03_dialer defined in line 27; never used
df_abort defined in line 93; never used
df_dialer defined in line 34; used 2 times

- in line 24, 31

df_disconnect defined in line 83; used 2 times

- in line 46, 96

timeout defined in line 100; used 2 times

- in line 18, 66

#### Defined variables

sccsid defined in line 8; never used

Last modified: 1985-06-06 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1116 |