summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-25 19:29:15 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-25 19:29:15 +0000
commit8045f8dba3be858c476d3e49a4532213ec374191 (patch)
tree030f6fea925e242ad68054d31a64b42c0462360c
parent3c97a34f31d0d3353e31bd413d40959051584e9b (diff)
XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_903_specialxf86-4_3_99_902xf86-4_3_99_901xf86-4_3_99_16xf86-012804-2330
-rw-r--r--xrdb.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/xrdb.c b/xrdb.c
index fd2707f..0f74c8a 100644
--- a/xrdb.c
+++ b/xrdb.c
@@ -30,7 +30,7 @@
* used in advertising or publicity pertaining to distribution of the software
* without specific, written prior permission.
*/
-/* $XFree86: xc/programs/xrdb/xrdb.c,v 3.16 2002/05/31 18:46:14 dawes Exp $ */
+/* $XFree86: xc/programs/xrdb/xrdb.c,v 3.17 2003/07/20 16:12:20 tsi Exp $ */
/*
* this program is used to load, or dump the resource manager database
@@ -52,6 +52,10 @@
#include <stdlib.h>
#include <stdarg.h>
+#if defined(sun) && defined(SVR4)
+#include <netdb.h> /* MAXHOSTNAMELEN */
+#endif
+
#define SCREEN_RESOURCES "SCREEN_RESOURCES"
#ifndef CPP
@@ -498,19 +502,28 @@ Resolution(int pixels, int mm)
static void
DoDisplayDefines(Display *display, String *defs, char *host)
{
-#define MAXHOSTNAME 255
- char client[MAXHOSTNAME], server[MAXHOSTNAME], *colon;
+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN 255
+#endif
+ char client[MAXHOSTNAMELEN], server[MAXHOSTNAMELEN], *colon;
char **extnames;
int n;
- XmuGetHostname(client, MAXHOSTNAME);
- strcpy(server, XDisplayName(host));
- colon = strchr(server, ':');
+ XmuGetHostname(client, MAXHOSTNAMELEN);
+ strncpy(server, XDisplayName(host), sizeof(server));
+ server[sizeof(server) - 1] = '\0';
+ /* search for final colon to skip over any embedded colons in IPv6
+ numeric address forms */
+ colon = strrchr(server, ':');
n = 0;
if (colon) {
+ /* remove extra colon if there are exactly two, since it indicates
+ DECnet. Three colons is an IPv6 address ending in :: though. */
+ if ((colon > server) && (*(colon-1) == ':') &&
+ ( ((colon - 1) == server) || (*(colon-2) != ':') ) ) {
+ *(colon-1) = ':';
+ }
*colon++ = '\0';
- if (*colon == ':')
- colon++;
sscanf(colon, "%d", &n);
}
if (!*server || !strcmp(server, "unix") || !strcmp(server, "localhost"))