summaryrefslogtreecommitdiff
path: root/src/CvtStdSel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/CvtStdSel.c')
-rw-r--r--src/CvtStdSel.c53
1 files changed, 33 insertions, 20 deletions
diff --git a/src/CvtStdSel.c b/src/CvtStdSel.c
index 9c2eb07..3020ee0 100644
--- a/src/CvtStdSel.c
+++ b/src/CvtStdSel.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/CvtStdSel.c,v 3.20 2001/12/14 19:55:39 dawes Exp $ */
/*
* This file contains routines to handle common selection targets.
@@ -54,7 +55,12 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xwinsock.h>
#define XOS_USE_MTSAFE_NETDBAPI
#else
+#ifndef Lynx
#include <sys/socket.h>
+#else
+#include <sys/types.h>
+#include <socket.h>
+#endif
#define XOS_USE_XT_LOCKING
#endif
#define X_INCLUDE_NETDB_H
@@ -62,6 +68,7 @@ in this Software without prior written authorization from The Open Group.
#endif
#include <X11/Xos.h>
+#include <stdlib.h>
#include "Atoms.h"
#include "StdSel.h"
#include "SysUtil.h"
@@ -78,18 +85,26 @@ in this Software without prior written authorization from The Open Group.
#ifdef ultrix
#define USE_UNAME
#endif
+#ifdef CSRG_BASED
+#define USE_UNAME
+#endif
#endif /*X_OS_FILE*/
#ifdef USE_UNAME
-#ifdef ultrix
-#ifndef __STDC__
-#include <limits.h> /* fixed in Ultrix 3.0 */
-#endif
-#endif
#include <sys/utsname.h>
#endif
#endif
-static char *get_os_name ()
+/*
+ * Prototypes
+ */
+static char *get_os_name(void);
+static Bool isApplicationShell(Widget);
+
+/*
+ * Implementation
+ */
+static char *
+get_os_name(void)
{
#ifdef OS_NAME
return XtNewString(OS_NAME);
@@ -101,9 +116,9 @@ static char *get_os_name ()
if (uname (&utss) == 0) {
char *os_name;
- int len = strlen(utss.sysname);
+ int len = strlen(utss.sysname) + 1;
#ifndef hpux /* because of hostname length crock */
- len += 1 + strlen(utss.release);
+ len += 2 + strlen(utss.release);
#endif
os_name = XtMalloc (len);
strcpy (os_name, utss.sysname);
@@ -139,7 +154,7 @@ static char *get_os_name ()
#ifdef sun
return XtNewString("SunOS");
#else
-# if !defined(SYSV) && defined(unix)
+# if !defined(SYSV) && (defined(CSRG_BASED) || defined(unix))
return XtNewString("BSD");
# else
return NULL;
@@ -157,8 +172,8 @@ static char *get_os_name ()
* go that far. Then, we test whether it is an applicationShellWidget
* class by looking for an explicit class name. Seems pretty safe.
*/
-static Bool isApplicationShell(w)
- Widget w;
+static Bool
+isApplicationShell(Widget w)
{
register WidgetClass c;
@@ -171,14 +186,10 @@ static Bool isApplicationShell(w)
return False;
}
-Boolean XmuConvertStandardSelection(w, time, selection, target,
- type, value, length, format)
- Widget w;
- Time time;
- Atom *selection, *target, *type;
- XPointer *value;
- unsigned long *length;
- int *format;
+Boolean
+XmuConvertStandardSelection(Widget w, Time time, Atom *selection, Atom *target,
+ Atom *type, XPointer *value,
+ unsigned long *length, int *format)
{
Display *d = XtDisplay(w);
if (*target == XA_TIMESTAMP(d)) {
@@ -203,10 +214,12 @@ Boolean XmuConvertStandardSelection(w, time, selection, target,
*format = 8;
return True;
}
-#ifdef TCPCONN
+#if defined(TCPCONN)
if (*target == XA_IP_ADDRESS(d)) {
char hostname[1024];
+#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
+#endif
struct hostent *hostp;
hostname[0] = '\0';