Subject: screen-3.9.8 ported to cygwin
From: [email-masked]
To: [email-masked]
Cc: [email-masked]
Date: Tue, 15 May 2001 10:42:14 -0400

I have made a naive attempt at porting screen 3.9.8 to cygwin,
and seem to have met with limited success.  The thing (seems to)
work, but when you close your last screen, it kills your console
window.  you also may have to mkdir /dev/pts  I'm afraid that I
can't remember the name, but screen'll tell you what file when
you first run it.  <G>

Here is the patch:

A remaining issue is that some of the commands in make install
fail, due to the .exe thing.  I tried to play with adding
@EXEEXT@ to Makefile.in (and AC_EXEEXT to configure.in) but found
that I started creating /opt/screen/bin/screen-3.9.8.exe.exe

At this point I decided to live with the error message. <G>

Are there porting guidelines that describe when/where/how to use
AC_EXEEXT?  

This is a Quick'n'Filthy[tm] patch.  It may electrocute you.  Don't
blame me.

------cut here-------
Index: screen-3.9.8/misc.c
diff -c screen-3.9.8/misc.c:1.1.1.1 screen-3.9.8/misc.c:1.2
*** screen-3.9.8/misc.c:1.1.1.1	Tue May 15 09:26:54 2001
--- screen-3.9.8/misc.c	Tue May 15 10:14:37 2001
***************
*** 22,28 ****
   */
  
  #include "rcs.h"
! RCS_ID("$Id: misc.c,v 1.1.1.1 2001/05/15 13:26:54 linguist Exp $ FAU")
  
  #include <sys/types.h>
  #include <sys/stat.h>	/* mkdir() declaration */
--- 22,28 ----
   */
  
  #include "rcs.h"
! RCS_ID("$Id: misc.c,v 1.2 2001/05/15 14:14:37 linguist Exp $ FAU")
  
  #include <sys/types.h>
  #include <sys/stat.h>	/* mkdir() declaration */
***************
*** 638,644 ****
     */
  # endif /* NEEDSETENV */
  #else /* USESETENV */
! # if defined(linux) || defined(__convex__) || (BSD >= 199103)
    setenv(var, value, 0);
  # else
    setenv(var, value);
--- 638,645 ----
     */
  # endif /* NEEDSETENV */
  #else /* USESETENV */
! # if defined(linux) || defined(__convex__) || (BSD >= 199103) \
!   || defined(__CYGWIN__)
    setenv(var, value, 0);
  # else
    setenv(var, value);
Index: screen-3.9.8/pty.c
diff -c screen-3.9.8/pty.c:1.1.1.1 screen-3.9.8/pty.c:1.2
*** screen-3.9.8/pty.c:1.1.1.1	Tue May 15 09:26:54 2001
--- screen-3.9.8/pty.c	Tue May 15 10:14:37 2001
***************
*** 22,28 ****
   */
  
  #include "rcs.h"
! RCS_ID("$Id: pty.c,v 1.1.1.1 2001/05/15 13:26:54 linguist Exp $ FAU")
  
  #include <sys/types.h>
  #include <sys/stat.h>
--- 22,28 ----
   */
  
  #include "rcs.h"
! RCS_ID("$Id: pty.c,v 1.2 2001/05/15 14:14:37 linguist Exp $ FAU")
  
  #include <sys/types.h>
  #include <sys/stat.h>
***************
*** 37,43 ****
  #endif
  
  /* for solaris 2.1, Unixware (SVR4.2) and possibly others */
! #ifdef HAVE_SVR4_PTYS
  # include <sys/stropts.h>
  #endif
  
--- 37,43 ----
  #endif
  
  /* for solaris 2.1, Unixware (SVR4.2) and possibly others */
! #if defined(HAVE_SVR4_PTYS) && !defined(__CYGWIN__)
  # include <sys/stropts.h>
  #endif
  
Index: screen-3.9.8/screen.c
diff -c screen-3.9.8/screen.c:1.1.1.1 screen-3.9.8/screen.c:1.2
*** screen-3.9.8/screen.c:1.1.1.1	Tue May 15 09:26:54 2001
--- screen-3.9.8/screen.c	Tue May 15 10:14:37 2001
***************
*** 31,37 ****
   */
  
  #include "rcs.h"
! RCS_ID("$Id: screen.c,v 1.1.1.1 2001/05/15 13:26:54 linguist Exp $ FAU")

  #include <sys/types.h>
--- 31,37 ----
   */
  
  #include "rcs.h"
! RCS_ID("$Id: screen.c,v 1.2 2001/05/15 14:14:37 linguist Exp $ FAU")

  #include <sys/types.h>
***************
*** 919,926 ****
--- 919,929 ----
  	      n = (eff_uid == 0 && (real_uid || (st.st_mode & 0775) != 0775)) ? 0755 :
  	          (eff_gid == st.st_gid && eff_gid != real_gid) ? 0775 :
  		  0777;
+ // NT is hopelessly broken in the area of file permissions.
+ #ifndef __CYGWIN__
  	      if ((st.st_mode & 0777) != n)
  		Panic(0, "Directory '%s' must have mode %03o.", SockDir, n);
+ #endif
  	    }
  	  sprintf(SockPath, "%s/S-%s", SockDir, LoginName);
  	  if (access(SockPath, F_OK))
***************
*** 950,957 ****
--- 953,962 ----
        if (st.st_uid != real_uid)
  	Panic(0, "You are not the owner of %s.", SockPath);
      }
+ #ifndef __CYGWIN__
    if ((st.st_mode & 0777) != 0700)
      Panic(0, "Directory %s must have mode 700.", SockPath);
+ #endif
    SockName = SockPath + strlen(SockPath) + 1;
    *SockName = 0;
    (void) umask(oumask);

------cut here-------

-- 
----------------------------------------------------------------
If this message was not digitally signed, do you really know who
it came from?  Encrypt everything, let the NSA sort it out.

Unsolicited email advertisements will be proofread and returned
for a fee of $500 per message.  Sending such email to this
address implies acceptance
of these terms.