Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!RPD.MACH.CS.CMU.EDU!Richard.Draves
From: Richard.Draves@RPD.MACH.CS.CMU.EDU
Newsgroups: comp.windows.x
Subject: xscope patches
Message-ID: <8811300410.AA20942@EXPO.LCS.MIT.EDU>
Date: 30 Nov 88 01:12:29 GMT
Sender: daemon@bloom-beacon.MIT.EDU
Organization: The Internet
Lines: 105

I ran into two problems compiling xscope for Mach.  4.3 may well have
these problems too.  Mach doesn't have SO_DONTLINGER.  The file scope.c
uses perror() before including .  The Mach  has a
prototype declaration for perror() (when __STDC__) and the
implicit int declaration conflicts with the later void declaration.  I
briefly tested xscope on RTs, Vaxen, and Suns without seeing any problems.
It looks very useful.

Rich

*** common.c.~1~	Tue Nov 29 16:07:28 1988
--- common.c	Tue Nov 29 16:40:06 1988
***************
*** 148,153 ****
--- 148,156 ----
  {
    FD ConnectionSocket;
    struct sockaddr_in  sin;
+ #ifndef	SO_DONTLINGER
+   struct linger linger;
+ #endif	SO_DONTLINGER
  
    enterprocedure("SetUpConnectionSocket");
  
***************
*** 160,166 ****
--- 163,175 ----
      }
    (void)setsockopt(ConnectionSocket, SOL_SOCKET, SO_REUSEADDR,   (char *)NULL, 0);
    (void)setsockopt(ConnectionSocket, SOL_SOCKET, SO_USELOOPBACK, (char *)NULL, 0);
+ #ifdef	SO_DONTLINGER
    (void)setsockopt(ConnectionSocket, SOL_SOCKET, SO_DONTLINGER,  (char *)NULL, 0);
+ #else	SO_DONTLINGER
+   linger.l_onoff = 0;
+   linger.l_linger = 0;
+   (void)setsockopt(ConnectionSocket, SOL_SOCKET, SO_LINGER, (char *)&linger, sizeof linger);
+ #endif	SO_DONTLINGER
  
    /* define the name and port to be used with the connection socket */
    bzero((char *)&sin, sizeof(sin));
*** scope.c.~1~	Tue Nov 29 16:07:23 1988
--- scope.c	Tue Nov 29 17:00:49 1988
***************
*** 9,14 ****
--- 9,22 ----
  
  #include "scope.h"
  
+ #include 	       /* needed by sys/socket.h and netinet/in.h */
+ #include 	       /* for struct iovec, used by socket.h */
+ #include 	       /* for AF_INET, SOCK_STREAM, ... */
+ #include 	       /* for FIONCLEX, FIONBIO, ... */
+ #include 	       /* struct sockaddr_in */
+ #include 	       /* struct servent * and struct hostent * */
+ #include 	       /* for EINTR, EADDRINUSE, ... */
+ extern int  errno;
  
  /* ********************************************** */
  /*                                                */
***************
*** 458,472 ****
  /*								*/
  /* ************************************************************ */
  
- #include 	       /* needed by sys/socket.h and netinet/in.h */
- #include 	       /* for struct iovec, used by socket.h */
- #include 	       /* for AF_INET, SOCK_STREAM, ... */
- #include 	       /* for FIONCLEX, FIONBIO, ... */
- #include 	       /* struct sockaddr_in */
- #include 	       /* struct servent * and struct hostent * */
- #include 	       /* for EINTR, EADDRINUSE, ... */
- extern int  errno;
- 
  static int  ON = 1 /* used in ioctl */ ;
  
  NewConnection(fd)
--- 466,471 ----
***************
*** 527,532 ****
--- 526,534 ----
    FD ServerFD;
    struct sockaddr_in  sin;
    struct hostent *hp;
+ #ifndef	SO_DONTLINGER
+   struct linger linger;
+ #endif	SO_DONTLINGER
  
    enterprocedure("ConnectToServer");
  
***************
*** 541,547 ****
--- 543,555 ----
      }
    (void) setsockopt(ServerFD, SOL_SOCKET, SO_REUSEADDR,  (char *) NULL, 0);
    (void) setsockopt(ServerFD, SOL_SOCKET, SO_USELOOPBACK,(char *) NULL, 0);
+ #ifdef	SO_DONTLINGER
    (void) setsockopt(ServerFD, SOL_SOCKET, SO_DONTLINGER, (char *) NULL, 0);
+ #else	SO_DONTLINGER
+   linger.l_onoff = 0;
+   linger.l_linger = 0;
+   (void) setsockopt(ServerFD, SOL_SOCKET, SO_LINGER, (char *)&linger, sizeof linger);
+ #endif	SO_DONTLINGER
  
    /* determine the host machine for this process */
    if (ServerHostName[0] == '\0')