home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / extra / uxkervms.c < prev   
C/C++ Source or Header  |  2020-01-01  |  2KB  |  89 lines

  1. #include <stdio.h>
  2. #include fab
  3. #include nam
  4. #include descrip
  5. #include iodef
  6. #include ssdef
  7. #include ttdef
  8. #include tt2def
  9.  
  10. extern int confd, debug, turn, ttnam;
  11.  
  12. ttopen(tn)
  13. char *tn;
  14. {
  15.     int fd;
  16.  
  17.     if (tn == 0)            /* Line name supplied? */
  18.     {
  19.     fd = open("SYS$OUTPUT",2);    /* Open the console */
  20.     confd = fd;            /* Save file descriptor for ttbin() */
  21.     }
  22.     else
  23.     {
  24.     fd = open(tn,2);        /* Open the specified line */
  25.     ttnam = tn;            /* Save file name for ttbin() */
  26.     }
  27.     if (fd < 0)
  28.     {
  29.     printmsg("Cannot open %s",tn);
  30.     exit(1);
  31.     }
  32.     return(fd);
  33. }  
  34.  
  35.  
  36. ttbin(fd,old)
  37. int fd, *old;
  38. {
  39.     int stat, new[3], *des;
  40.     $DESCRIPTOR(sys_con,"SYS$OUTPUT");    /* Descriptor for the console */
  41.     $DESCRIPTOR(sys_tt,"TTA0");        /* Line descriptor to fill in later */
  42.  
  43.     if (fd == confd)             /* Is this the console? */
  44.     stat = SYS$ASSIGN(&sys_con,&old[3],0,0);
  45.     else
  46.     {
  47.     sys_tt.dsc$a_pointer = ttnam;    /* Set up this descriptor with the */
  48.     sys_tt.dsc$w_length = strlen(ttnam); /* right tty name */
  49.     stat = SYS$ASSIGN(&sys_tt,&old[3],0,0);
  50.     }
  51.  
  52.     if (stat != SS$_NORMAL)
  53.     {
  54.     if (debug) printf("SYS$ASSIGN: Abnormal return: %d\n",stat);
  55.     exit(1);
  56.     }
  57.     if (debug) printf("SYS$OUTPUT open on channel %d\n",old[3]);
  58.  
  59.     SYS$QIOW(0,old[3],IO$_SENSEMODE,0,0,0,old,12,0,0,0,0);
  60.     if (debug) printf("Old TTY characteristics: %o %o %o\n",old[0], old[1],
  61.     old[2]);
  62.  
  63.     stat = SYS$QIOW(0,old[3],IO$_SENSEMODE,0,0,0,new,12,0,0,0,0);
  64.     if (stat != SS$_NORMAL)
  65.     {
  66.     if (debug) printf("SYS$QIOW: Abnormal return: %d\n",stat);
  67.     exit(1);
  68.     }
  69.  
  70.     new[1] |= TT$M_EIGHTBIT | TT$M_NOBRDCST | TT$M_NOECHO | TT$M_PASSALL;
  71.     new[1] &= ~ (TT$M_CRFILL | TT$M_ESCAPE | TT$M_HALFDUP | TT$M_HOLDSCREEN |
  72.         TT$M_LFFILL | TT$M_NOTYPEAHD | TT$M_READSYNC | TT$M_WRAP);
  73.     new[2] &= ~ TT2$M_LOCALECHO;
  74.     SYS$QIOW(0,old[3],IO$_SETMODE,0,0,0,new,12,0,0,0,0);
  75.     if (debug)
  76.     printf("New TTY characteristics: %o %o %o\n",new[0],new[1],new[2]);
  77. }
  78.  
  79. ttres(fd,old)
  80. int fd, *old;
  81. {
  82.     SYS$QIOW(0,old[3],IO$_SETMODE,0,0,0,old,12,0,0,0,0);
  83. }
  84.  
  85. connect()
  86. {
  87.     printf("Connect command not implemented in this version\n");
  88. }
  89.