home *** CD-ROM | disk | FTP | other *** search
/ The UNIX CD Bookshelf / OREILLY_TUCB_UNIX_CD.iso / upt / examples / SOURCES / SCREEN / I386 / SCREEN. next >
Encoding:
Text File  |  1998-07-24  |  4.3 KB  |  172 lines

  1. --- os.h.rtr    Mon Nov 20 13:03:04 1995
  2. +++ os.h    Mon Nov 27 10:09:54 1995
  3. @@ -441,7 +441,8 @@
  4.   *    select stuff
  5.   */
  6.  
  7. -#if defined(M_XENIX) || defined(M_UNIX) || defined(_SEQUENT_)
  8. +/* #if defined(M_XENIX) || defined(M_UNIX) || defined(_SEQUENT_) */
  9. +#if 0
  10.  #include <sys/select.h>        /* for timeval + FD... */
  11.  #endif
  12.  
  13. --- pty.c.rtr    Mon Nov 20 13:03:05 1995
  14. +++ pty.c    Mon Nov 27 13:26:35 1995
  15. @@ -61,6 +61,9 @@
  16.  #ifndef PTYRANGE1
  17.  # define PTYRANGE1 "0123456789abcdef"
  18.  #endif
  19. +#ifndef PTYRANGE2
  20. +# define PTYRANGE2 "\n\n"
  21. +#endif
  22.  
  23.  extern int eff_uid;
  24.  
  25. @@ -282,7 +285,7 @@
  26.  OpenPTY(ttyn)
  27.  char **ttyn;
  28.  {
  29. -  register char *p, *q, *l, *d;
  30. +  register char *p, *q, *l, *d, *e, *e_start;
  31.    register int f;
  32.  
  33.    debug("OpenPTY: Using BSD style ptys.\n");
  34. @@ -296,35 +299,40 @@
  35.      {
  36.        for (d = PTYRANGE1; (p[1] = *d) != '\0'; d++)
  37.      {
  38. -      debug1("OpenPTY tries '%s'\n", PtyName);
  39. -      if ((f = open(PtyName, O_RDWR | O_NOCTTY)) == -1)
  40. -        continue;
  41. -      q[0] = *l;
  42. -      q[1] = *d;
  43. -      if (eff_uid && access(TtyName, R_OK | W_OK))
  44. -        {
  45. -          close(f);
  46. -          continue;
  47. -        }
  48. -#if defined(sun) && defined(TIOCGPGRP) && !defined(SUNOS3)
  49. -      /* Hack to ensure that the slave side of the pty is
  50. -       * unused. May not work in anything other than SunOS4.1
  51. -       */
  52. -        {
  53. -          int pgrp;
  54. -
  55. -          /* tcgetpgrp does not work (uses TIOCGETPGRP)! */
  56. -          if (ioctl(f, TIOCGPGRP, (char *)&pgrp) != -1 || errno != EIO)
  57. -        {
  58. -          close(f);
  59. -          continue;
  60. -        }
  61. -        }
  62. -#endif
  63. -      initpty(f);
  64. -      *ttyn = TtyName;
  65. -      return f;
  66. -    }
  67. +           for (e_start = (e = PTYRANGE2); ((p[2] = *e) != '\0') || (e == e_start ) ; e++)
  68. +             {
  69. +           debug1("OpenPTY tries '%s'\n", PtyName);
  70. +           if ((f = open(PtyName, O_RDWR | O_NOCTTY)) == -1)
  71. +             continue;
  72. +           q[0] = *l;
  73. +           q[1] = *d;
  74. +           q[2] = *e;
  75. +           if (eff_uid && access(TtyName, R_OK | W_OK))
  76. +             {
  77. +               close(f);
  78. +               continue;
  79. +             }
  80. +  #if defined(sun) && defined(TIOCGPGRP) && !defined(SUNOS3)
  81. +         /* Hack to ensure that the slave side of the pty is
  82. +          * unused. May not work in anything other than SunOS4.1
  83. +          */
  84. +             {
  85. +               int pgrp;
  86. +     
  87. +             /* tcgetpgrp does not work (uses TIOCGETPGRP)! */
  88. +               if (ioctl(f, TIOCGPGRP, (char *)&pgrp) != -1 || errno != EIO)
  89. +                 {
  90. +                   close(f);
  91. +                   continue;
  92. +                 }
  93. +             }
  94. + #endif
  95. +           initpty(f);
  96. +           *ttyn = TtyName;
  97. +           return f;
  98. +         }
  99. +       }
  100. +
  101.      }
  102.    return -1;
  103.  }
  104. --- resize.c.rtr    Mon Nov 20 13:03:05 1995
  105. +++ resize.c    Mon Nov 27 10:09:54 1995
  106. @@ -55,6 +55,8 @@
  107.  extern int nethackflag;
  108.  #endif
  109.  
  110. +#include <sys/stream.h>
  111. +#include <sys/ptem.h>        /* for winsize struct */
  112.  #if defined(TIOCGWINSZ) || defined(TIOCSWINSZ)
  113.    struct winsize glwz;
  114.  #endif
  115. --- screen.c.rtr    Mon Nov 20 13:03:05 1995
  116. +++ screen.c    Mon Nov 27 10:09:53 1995
  117. @@ -28,6 +28,7 @@
  118.  #include <sys/types.h>
  119.  #include <ctype.h>
  120.  
  121. +#include <sys/wait.h>
  122.  #include <fcntl.h>
  123.  
  124.  #ifdef sgi
  125. --- tty.c.dist.rtr    Mon Nov 20 13:06:17 1995
  126. +++ tty.c.dist    Mon Nov 27 13:38:42 1995
  127. @@ -852,11 +852,11 @@
  128.      {
  129.  #ifdef POSIX 
  130.        debug("tcsendbreak\n");
  131. -      if (tcsendbreak(wp->w_ptyfd, n) < 0)
  132. +/*      if (tcsendbreak(wp->w_ptyfd, n) < 0)
  133.      {
  134.        Msg(errno, "cannot send BREAK");
  135.        return;
  136. -    }
  137. +    } */
  138.  #else
  139.        if (!n)
  140.      n++;
  141. --- window.c.rtr    Mon Nov 20 13:03:05 1995
  142. +++ window.c    Mon Nov 27 10:10:18 1995
  143. @@ -41,6 +41,8 @@
  144.  #include "screen.h"
  145.  #include "extern.h"
  146.  
  147. +#include <sys/stream.h>
  148. +#include <sys/ptem.h>        /* for winsize */
  149.  extern struct display *displays, *display;
  150.  extern struct win *windows, *fore, *wtab[], *console_window;
  151.  extern char *ShellArgs[];
  152. --- osdef.h.in.rtr    Tue Feb 11 09:41:30 1997
  153. +++ osdef.h.in    Tue Feb 11 10:44:52 1997
  154. @@ -65,7 +65,7 @@
  155.  union wait;        /* for wait3 __P */
  156.  extern int   wait3 __P((union wait *, int, struct rusage *));
  157.  #else
  158. -extern int   waitpid __P((int, int *, int));
  159. +/* extern int   waitpid __P((int, int *, int)); */
  160.  #endif
  161.  
  162.  extern int   getdtablesize __P((void));
  163. @@ -98,7 +98,7 @@
  164.  extern int   setpgid __P((int, int));
  165.  extern int   tcsetpgrp __P((int, int));
  166.  #endif
  167. -extern int   ioctl __P((int, int, char *));
  168. +/* extern int   ioctl __P((int, int, char *)); */
  169.  
  170.  extern int   kill __P((int, int));
  171.  
  172.