[comp.windows.x] Header file problems.

mason@PESCADERO.STANFORD.EDU (07/23/87)

I'm not sure if anyone else has found/reported this bug, but I thought it
would be a good idea to report it/ask about it.

(XV10R4 on a VAX 8350, Ultrix-32 V2.0)
In 4.3BSD systems which use the new structure definition for host entries has
been changed, I have had some problem with XOpenDisplay crashing (in bcopy).
What I did was change the reference from host_ptr->h_addr, (which transforms
via cpp to host_ptr->h_addr_list[0]) to host_ptr->h_addr_list. I've posted
context diff at the end of this note.  I placed #ifdefs in it that should
make it work on either type of system,  but I only tested it with the
change.

(XV11-beta.1 on a VAX 8350, Ultrix-32 V2.0)
Also, I've been having some problems under Ultrix 2.0 with the header file
sys/type.h.  Has anyone else experienced this problem?   I suspect a bug in
the compiler but cannot confirm this.

Tony Mason
Distributed Systems Group
Stanford University
mason@pescadero.stanford.edu

-------- XOpenDisplay.c diff --------
*** XOpenDisplay.c      Thu Jul 23 13:45:55 1987
--- ../Xlib/XOpenDisplay.c      Wed Dec 24 06:08:57 1986
***************
*** 105,112
   
                        /* Set up the socket data. */
                        inaddr.sin_family = host_ptr->h_addrtype;
! #ifdef h_addr
!                       bcopy((char *)host_ptr->h_addr_list,
                              (char *)&inaddr.sin_addr, 
                              sizeof(inaddr.sin_addr));
  #else /* not h_addr */

--- 105,111 -----
   
                        /* Set up the socket data. */
                        inaddr.sin_family = host_ptr->h_addrtype;
!                       bcopy((char *)host_ptr->h_addr, 
                              (char *)&inaddr.sin_addr, 
                              sizeof(inaddr.sin_addr));
                } else {
***************
*** 109,119
                        bcopy((char *)host_ptr->h_addr_list,
                              (char *)&inaddr.sin_addr, 
                              sizeof(inaddr.sin_addr));
- #else /* not h_addr */
-                       bcopy((char *)host_ptr->h_addr_list,
-                             (char *)&inaddr.sin_addr, 
-                             sizeof(inaddr.sin_addr));
- #endif /* h_addr */
                } else {
                        inaddr.sin_family = AF_INET;
                }

--- 108,113 -----
                        bcopy((char *)host_ptr->h_addr, 
                              (char *)&inaddr.sin_addr, 
                              sizeof(inaddr.sin_addr));
                } else {
                        inaddr.sin_family = AF_INET;
               }