Convert uses of XKeycodeToKeysym (deprecated) to XkbKeycodeToKeysym
[oweals/cde.git] / cde / lib / DtSvc / DtEncap / spc-net.c
index 6c71948957480c12661be8a15c680fa6fee76eed..fafff20b2ead9c25f4606b5ab3cb321c2d62ce7b 100644 (file)
@@ -1,3 +1,25 @@
+/*
+ * CDE - Common Desktop Environment
+ *
+ * Copyright (c) 1993-2012, The Open Group. All rights reserved.
+ *
+ * These libraries and programs are free software; you can
+ * redistribute them and/or modify them under the terms of the GNU
+ * Lesser General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * These libraries and programs are distributed in the hope that
+ * they will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with these libraries and programs; if not, write
+ * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301 USA
+ */
 /* $XConsortium: spc-net.c /main/9 1996/11/21 19:53:44 drk $
  * File:         spc-net.c 
  * Language:     C
@@ -150,6 +172,7 @@ Boolean SPC_Init_Local_Host_Info(void)
  */
 
 /*----------------------------------------------------------------------+*/
+int
 SPC_Local_Hostname(XeString hostname)
 /*----------------------------------------------------------------------+*/
 {
@@ -265,6 +288,7 @@ SPC_Connection_Ptr SPC_Open_Connection(XeString hostname)
 }
 
 /*----------------------------------------------------------------------+*/
+int
 SPC_Open_Socket(SPC_Connection_Ptr conn,
                int type)
 /*----------------------------------------------------------------------+*/
@@ -272,7 +296,7 @@ SPC_Open_Socket(SPC_Connection_Ptr conn,
 
   struct servent *service;
   
-  conn->sid=socket(type, SOCK_STREAM, NULL);
+  conn->sid=socket(type, SOCK_STREAM, 0);
   if(conn->sid == ERROR) {
     SPC_Error(SPC_Bad_Socket);
     return(SPC_ERROR);
@@ -297,6 +321,7 @@ SPC_Open_Socket(SPC_Connection_Ptr conn,
 */
 
 /*----------------------------------------------------------------------+*/
+int
 SPC_Contact_Server(SPC_Connection_Ptr connection)
 /*----------------------------------------------------------------------+*/
 {
@@ -319,8 +344,10 @@ SPC_Contact_Server(SPC_Connection_Ptr connection)
   memcpy(&saddr.sin_addr, remote->h_addr, remote->h_length);
 
   if(connect(connection->sid, (struct sockaddr *)&saddr, sizeof(saddr)) == ERROR) {
-    SPC_Error(SPC_Bad_Connect,
-             XeFindShortHost(remote->h_name));
+    XeString shorthost = XeFindShortHost(remote->h_name);
+    SPC_Error(SPC_Bad_Connect, shorthost);
+    XeFree(shorthost);
+    
     return(SPC_ERROR);
   }
 
@@ -361,12 +388,7 @@ SPC_Connection_Ptr SPC_Init_Child(SPC_Connection_Ptr conn,
 SPC_Connection_Ptr SPC_Standalone_Daemon(SPC_Connection_Ptr conn)
 {
   struct sockaddr_in saddr, client_saddr;
-#ifdef USL
-  /* Only UnixWare 2.02 uses the Spec1170 parameter profile for accept(). */
-  size_t len=sizeof(client_saddr);
-#else
   int len=sizeof(client_saddr);
-#endif
   int server_bind_attempts      = MAX_SERVER_BIND_ATTEMPTS;
   int server_bind_pause         = SERVER_PAUSE_INTERVAL;
   int pid, from;
@@ -384,7 +406,7 @@ SPC_Connection_Ptr SPC_Standalone_Daemon(SPC_Connection_Ptr conn)
 #if defined(__aix)
   if (setsockopt(conn->sid, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))==ERROR) {
 #else
-  if (setsockopt(conn->sid, SOL_SOCKET, SO_REUSEADDR, NULL, NULL)==ERROR) {
+  if (setsockopt(conn->sid, SOL_SOCKET, SO_REUSEADDR, NULL, 0)==ERROR) {
 #endif
     SPC_Error(SPC_Bad_Reuse);
     return(SPC_ERROR);
@@ -459,6 +481,7 @@ SPC_Connection_Ptr SPC_Standalone_Daemon(SPC_Connection_Ptr conn)
 }
 
 /*----------------------------------------------------------------------+*/
+int
 SPC_Inetd_Daemon(SPC_Connection_Ptr conn)
 /*----------------------------------------------------------------------+*/
 {