summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore22
-rw-r--r--AUTHORS2
-rw-r--r--COPYING46
-rw-r--r--Imakefile64
-rw-r--r--Makefile.am114
-rw-r--r--NEWS0
-rw-r--r--audio.c8
-rwxr-xr-xautogen.sh13
-rw-r--r--common.c287
-rw-r--r--configure.ac64
-rw-r--r--decode11.c56
-rw-r--r--fd.c112
-rw-r--r--fd.h62
-rw-r--r--print11.c370
-rw-r--r--proto.h271
-rw-r--r--prtype.c294
-rw-r--r--scope-transport.c10
-rw-r--r--scope.c421
-rw-r--r--scope.h59
-rw-r--r--server.c108
-rw-r--r--table11.c283
-rw-r--r--x11.h132
-rw-r--r--xscope.man200
23 files changed, 2302 insertions, 696 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c49c4a1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,22 @@
+.deps
+ChangeLog
+Makefile
+Makefile.in
+aclocal.m4
+xscope
+xscope.1
+autom4te.cache
+compile
+config.guess
+config.h
+config.h.in
+config.log
+config.status
+config.sub
+configure
+depcomp
+install-sh
+missing
+stamp-h1
+*.o
+*~
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..b3bbcec
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+James Peterson, MCC
+Keith Packard
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..ef5eba7
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,46 @@
+Copyright (C) 1988 MCC
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation, and that the name of MCC not be used in
+advertising or publicity pertaining to distribution of the software without
+specific, written prior permission. MCC makes no
+representations about the suitability of this software for any purpose. It
+is provided "as is" without express or implied warranty.
+
+MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL MCC BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
diff --git a/Imakefile b/Imakefile
deleted file mode 100644
index 827cb69..0000000
--- a/Imakefile
+++ /dev/null
@@ -1,64 +0,0 @@
-##
-# $XConsortium: Imakefile,v 5.11 91/09/17 08:52:54 rws Exp $
-##
-##
-## Copyright 1990, 1991, 1990 by Sun Microsystems, Inc. and the X Consortium.
-##
-## All Rights Reserved
-##
-## Permission to use, copy, modify, and distribute this software and its
-## documentation for any purpose and without fee is hereby granted,
-## provided that the above copyright notice appear in all copies and that
-## both that copyright notice and this permission notice appear in
-## supporting documentation, and that the names of Sun Microsystems,
-## the X Consortium, and MIT not be used in advertising or publicity
-## pertaining to distribution of the software without specific, written
-## prior permission.
-##
-## SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-## INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-## EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-## CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
-## USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-## OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-## PERFORMANCE OF THIS SOFTWARE.
-
- SYS_LIBRARIES = -lm
-#if BuildPEX
- PEX_INCLUDE = $(INCDIR)/extensions
- PEX_SRC = decode_pex.c print_pex.c
- PEX_OBJ = decode_pex.o print_pex.o
- PEX_DEFINES = -DPEX
-#endif
- DEFINES = $(PEX_DEFINES)
-
- SRCS = prtype.c print11.c table11.c decode11.c \
- server.c fd.c common.c scope.c audio.c \
- decode_lbx.c print_lbx.c printnas.c decodenas.c \
- decode_wcp.c print_wcp.c decode_render.c print_render.c \
- decode_randr.c print_randr.c decode_shm.c print_shm.c \
- decode_bigreq.c print_bigreq.c $(PEX_SRC)
- OBJS = scope.o common.o fd.o server.o decode11.o \
- table11.o print11.o prtype.o audio.o \
- decode_lbx.o print_lbx.o printnas.o decodenas.o \
- decode_wcp.o print_wcp.o decode_render.o print_render.o \
- decode_randr.o print_randr.o decode_shm.o print_shm.o \
- decode_bigreq.o print_bigreq.o $(PEX_OBJ)
-
-ComplexProgramTarget(xscope)
-SpecialObjectRule(common.o,$(_NOOP_),$(SIGNAL_DEFINES))
-
-#if BuildPEX
-includes:: pexRNames.h pexOCNames.h
-
-pexOCNames.h: pexOCTab.awk $(PEX_INCLUDE)/PEX.h
- $(RM) $@
- awk -f pexOCTab.awk $(PEX_INCLUDE)/PEX.h > $@
-
-pexRNames.h: pexRTab.awk $(PEX_INCLUDE)/PEX.h
- $(RM) $@
- awk -f pexRTab.awk $(PEX_INCLUDE)/PEX.h > $@
-depend:: pexRNames.h pexOCNames.h
-
-clean:: pexRNames.h pexOCNames.h
-#endif
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..8ccda83
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,114 @@
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use subject to license terms.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+
+bin_PROGRAMS = xscope
+
+AM_CFLAGS = $(XSCOPE_CFLAGS)
+xscope_LDADD = $(XSCOPE_LIBS)
+
+xscope_SOURCES = \
+ audio.c \
+ bigreqscope.h \
+ common.c \
+ decode11.c \
+ decode_bigreq.c \
+ decode_lbx.c \
+ decode_randr.c \
+ decode_render.c \
+ decode_shm.c \
+ decode_wcp.c \
+ decodenas.c \
+ fd.c \
+ fd.h \
+ lbxscope.h \
+ nas.h \
+ patchlevel.h \
+ print11.c \
+ print_bigreq.c \
+ print_lbx.c \
+ print_randr.c \
+ print_render.c \
+ print_shm.c \
+ print_wcp.c \
+ printnas.c \
+ proto.h \
+ prtype.c \
+ randrscope.h \
+ renderscope.h \
+ scope-transport.c \
+ scope.c \
+ scope.h \
+ server.c \
+ shmscope.h \
+ table11.c \
+ wcpscope.h \
+ x11.h
+
+appman_PRE = \
+ xscope.man
+
+appmandir = $(APP_MAN_DIR)
+
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+
+EXTRA_DIST = $(appman_PRE) ChangeLog autogen.sh
+CLEANFILES = $(appman_DATA)
+MAINTAINERCLEANFILES = ChangeLog
+
+.PHONY: ChangeLog
+
+ChangeLog:
+ (GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
+
+dist-hook: ChangeLog
+
+SED = sed
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+ XORGMANNAME = X Version 11
+
+MAN_SUBSTS = \
+ -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+ -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+ -e 's|__xservername__|Xorg|g' \
+ -e 's|__xconfigfile__|xorg.conf|g' \
+ -e 's|__projectroot__|$(prefix)|g' \
+ -e 's|__apploaddir__|$(appdefaultdir)|' \
+ -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
+ -e 's|__libmansuffix__|$(LIB_MAN_SUFFIX)|g' \
+ -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
+ -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
+ -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
+
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+ sed $(MAN_SUBSTS) < $< > $@
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/NEWS
diff --git a/audio.c b/audio.c
index 4bf2056..97cfbf3 100644
--- a/audio.c
+++ b/audio.c
@@ -443,7 +443,7 @@ FD ConnectToAudioClient(ConnectionSocket)
{
FD ClientFD;
ClientFD = AcceptConnection(ConnectionSocket);
- UsingFD(ClientFD, DataFromAudioClient, FlushFD);
+ UsingFD(ClientFD, DataFromAudioClient, FlushFD, NULL);
StartAudioClientConnection(ClientFD);
return(ClientFD);
}
@@ -452,12 +452,14 @@ FD ConnectToAudioServer(report)
Boolean report;
{
FD ServerFD;
+ XtransConnInfo trans_conn = NULL; /* transport connection object */
+
if (!AudioServerHostName[0])
strcpy (AudioServerHostName, ServerHostName);
- ServerFD = MakeConnection (AudioServerHostName, GetServerport () + 2000, report);
+ ServerFD = MakeConnection (AudioServerHostName, GetServerport () + 2000, report, &trans_conn);
if (ServerFD >= 0)
{
- UsingFD(ServerFD, DataFromAudioServer, FlushFD);
+ UsingFD(ServerFD, DataFromAudioServer, FlushFD, trans_conn);
StartAudioServerConnection(ServerFD);
}
return(ServerFD);
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..e81f989
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+autoreconf -v --install || exit 1
+cd $ORIGDIR || exit $?
+
+$srcdir/configure --enable-maintainer-mode "$@"
+
diff --git a/common.c b/common.c
index d8df033..2605a08 100644
--- a/common.c
+++ b/common.c
@@ -23,29 +23,67 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* *
+ * *
+ * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ * *
\* *********************************************************** */
#include "scope.h"
#include <fcntl.h>
+#ifdef SYSV
+#define bzero(s,l) memset(s, 0, l)
+#define bcopy(s,d,l) memmove(d,s,l)
+#endif
+
+#include <unistd.h>
+
/* ********************************************** */
/* */
/* Debugging support routines */
/* */
/* ********************************************** */
+void
enterprocedure(s)
char *s;
{
debug(2,(stderr, "-> %s\n", s));
}
+void
warn(s)
char *s;
{
fprintf(stderr, "####### %s\n", s);
}
+void
panic(s)
char *s;
{
@@ -59,21 +97,18 @@ panic(s)
/* */
/* ********************************************** */
-extern char *malloc();
-
-char *Malloc (n)
- long n;
+void *Malloc (long n)
{
- char *p;
- p = (char *)malloc((unsigned int)n);
+ void *p;
+ p = malloc(n);
debug(64,(stderr, "%x = malloc(%d)\n", p, n));
if (p == NULL)
panic("no more malloc space");
return(p);
}
-Free(p)
- char *p;
+void
+Free(void *p)
{
debug(64,(stderr, "%x = free\n", p));
free(p);
@@ -90,77 +125,47 @@ Free(p)
#define __USE_BSD_SIGNAL
#include <signal.h>
-#ifdef SIGNALRETURNSINT
-#define SIGVAL int
-#else
-#define SIGVAL void
-#endif
-
-/* ARGSUSED */
-SIGVAL
-SignalURG(n)
- int n;
+static void SignalURG(int sig)
{
debug(1,(stderr, "==> SIGURG received\n"));
}
-/* ARGSUSED */
-SIGVAL
-SignalPIPE(n)
- int n;
+static void SignalPIPE(int sig)
{
signal (SIGPIPE, SignalPIPE);
debug(1,(stderr, "==> SIGPIPE received\n"));
}
-/* ARGSUSED */
-SIGVAL
-SignalINT(n)
- int n;
+static void SignalINT(int sig)
{
signal (SIGINT, SignalINT);
debug(1,(stderr, "==> SIGINT received\n"));
Interrupt = 1;
}
-/* ARGSUSED */
-SIGVAL
-SignalQUIT(n)
- int n;
+static void SignalQUIT(int sig)
{
debug(1,(stderr, "==> SIGQUIT received\n"));
exit(1);
}
-/* ARGSUSED */
-SIGVAL
-SignalTERM(n)
- int n;
+static void SignalTERM(int sig)
{
debug(1,(stderr, "==> SIGTERM received\n"));
exit(1);
}
-/* ARGSUSED */
-SIGVAL
-SignalTSTP(n)
- int n;
+static void SignalTSTP(int sig)
{
debug(1,(stderr, "==> SIGTSTP received\n"));
}
-/* ARGSUSED */
-SIGVAL
-SignalCONT(n)
- int n;
+static void SignalCONT(int sig)
{
debug(1,(stderr, "==> SIGCONT received\n"));
}
-/* ARGSUSED */
-SIGVAL
-SignalUSR1(n)
- int n;
+static void SignalUSR1(int sig)
{
extern char ScopeEnabled;
@@ -168,6 +173,7 @@ SignalUSR1(n)
ScopeEnabled = ! ScopeEnabled;
}
+void
SetSignalHandling()
{
extern char HandleSIGUSR1;
@@ -192,26 +198,55 @@ SetSignalHandling()
/* */
/* ************************************************************ */
+#ifdef USE_XTRANS
+
+#define TRANS_CLIENT
+#define TRANS_SERVER
+#define X11_t
+#include <X11/Xtrans/Xtrans.h>
+static XtransConnInfo *ListenTransConns = NULL;
+static int *ListenTransFds = NULL;
+static int ListenTransCount;
+
+#else
+
+#include <sys/types.h> /* needed by sys/socket.h and netinet/in.h */
#include <sys/uio.h> /* for struct iovec, used by socket.h */
#include <sys/socket.h> /* for AF_INET, SOCK_STREAM, ... */
#include <sys/ioctl.h> /* for FIONCLEX, FIONBIO, ... */
+#include <sys/fcntl.h> /* for FIONCLEX, FIONBIO, ... */
#ifdef SVR4
#include <sys/filio.h>
#endif
+
#include <netinet/in.h> /* struct sockaddr_in */
#include <netdb.h> /* struct servent * and struct hostent * */
+#ifdef DNETCONN
+#include <X11/dni.h>
+#endif
+#ifdef DNETSVR4
+#include <X11/dni8.h>
+#include <dlfcn.h>
+struct hostent *(*dnet_gethostbyname)();
+int (*dnet_gethostname)();
+short initialize_libdni();
+#endif
static int ON = 1 /* used in ioctl */ ;
#define BACKLOG 5
+#endif
-/* for use in the UsingFD call -- defined later */
-extern int NewConnection ();
-
-
+void
SetUpConnectionSocket(iport, connectionFunc)
int iport;
int (*connectionFunc)();
{
+#ifdef USE_XTRANS
+ char port[20];
+ int partial;
+ int i;
+ extern long ServerBasePort;
+#else
FD ConnectionSocket;
struct sockaddr_in sin;
short port;
@@ -219,9 +254,35 @@ SetUpConnectionSocket(iport, connectionFunc)
#ifndef SO_DONTLINGER
struct linger linger;
#endif /* SO_DONTLINGER */
+#endif
enterprocedure("SetUpConnectionSocket");
+#ifdef USE_XTRANS
+ ScopePort = iport - ServerBasePort;
+ sprintf (port, "%d", ScopePort);
+ if ((_X11TransMakeAllCOTSServerListeners (port, &partial,
+ &ListenTransCount, &ListenTransConns) >= 0) &&
+ (ListenTransCount >= 1)) {
+ if (partial) {
+ debug(4,(stderr,
+ "Warning: Failed to establish listening connections on some transports\n"));
+ }
+ ListenTransFds = (int *) malloc (ListenTransCount * sizeof (int));
+
+ for (i = 0; i < ListenTransCount; i++)
+ {
+ int fd = _X11TransGetConnectionNumber (ListenTransConns[i]);
+
+ ListenTransFds[i] = fd;
+ debug(4,(stderr, "Listening on FD %d\n", fd));
+ UsingFD(fd, NewConnection, NULL, ListenTransConns[i]);
+ }
+ } else {
+ panic("Could not open any listening connections");
+ }
+#else
+
/* create the connection socket and set its parameters of use */
ConnectionSocket = socket(AF_INET, SOCK_STREAM, 0);
if (ConnectionSocket < 0)
@@ -254,8 +315,8 @@ SetUpConnectionSocket(iport, connectionFunc)
struct hostent *hp;
(void) gethostname(MyHostName, sizeof(MyHostName));
- ScopeHost = (char *) Malloc((long)strlen(MyHostName));
- (void)strcpy(ScopeHost, MyHostName);
+ ScopeHost = (char *) Malloc((long)(1+strlen(MyHostName)));
+ strcpy(ScopeHost, MyHostName);
hp = gethostbyname(MyHostName);
if (hp == NULL)
panic("No address for our host");
@@ -305,5 +366,125 @@ SetUpConnectionSocket(iport, connectionFunc)
#endif
debug(4,(stderr, "Listening on FD %d\n", ConnectionSocket));
- UsingFD(ConnectionSocket, connectionFunc, 0);
+ UsingFD(ConnectionSocket, connectionFunc, NULL, NULL);
+#endif
}
+
+#ifndef USE_XTRANS
+#ifdef DNETSVR4
+SetUpDECnetConnection(display)
+int display;
+{
+ struct sockaddr_dn *sdn,sdnn; /* DECnet socket */
+ struct hostent *hp;
+ int sock;
+ char hostname[6];
+
+ if (!initialize_libdni()) {
+ fprintf(stderr,"Unable to open libdni.so\n");
+ exit(0);
+ }
+ sdn = &sdnn;
+ if (!(dnet_gethostname)(hostname)) {
+ fprintf(stderr,"Can't get DECnet local host name\n");
+ exit(0);
+ }
+ if ((hp = (struct hostent *)(dnet_gethostbyname)(hostname)) == NULL) {
+ fprintf(stderr,"xhost: can't get name %s\n",hostname);
+ exit(0);
+ }
+ sdn->sdn_family = AF_DECnet;
+ sdn->sdn_format = DNADDR_FMT1;
+ sdn->sdn_port = 0;
+ sprintf ((char *)sdn->sdn_name, "X$X%d", display);
+ sdn->sdn_namelen = strlen((char *)sdn->sdn_name);
+ sdn->sdn_addr = *(u_short *)hp->h_addr_list[0];
+
+ if ((sock = socket (AF_DECnet, SOCK_STREAM, 0)) < 0) {
+ perror("socket");
+ exit(0);
+ }
+ (void)setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)NULL, 0);
+ (void)setsockopt(sock, SOL_SOCKET, SO_USELOOPBACK, (char *)NULL, 0);
+
+ if (bind(sock, (struct sockaddr_dn *)sdn,
+ sizeof(struct sockaddr_dn)) < 0) {
+ perror("DNI Bind");
+ exit(0);
+ }
+ if (listen(sock, 100) < 0) {
+ perror("DNI Listen");
+ exit(0);
+ }
+
+ UsingFD(sock, NewConnection, NULL, NULL);
+}
+#endif
+
+#ifdef DNETCONN
+SetUpDECnetConnection(display)
+int display;
+{
+ struct ses_io_type sesopts;
+ char objname[6];
+ FD fd;
+
+ enterprocedure("SetUpDECnetConnection");
+ sprintf (objname, "X$X%d", display);
+ if ((fd = open("/dev/dni", O_RDWR)) < 0) {
+ fprintf(stderr,"xscope: dni: open failed\n");
+ exit(-1);
+ }
+ if (ioctl(fd, SES_GET_LINK, 0)) {
+ fprintf(stderr,"xscope: dni: can't get link\n");
+ exit(-1);
+ }
+ /* set nonblocking here since dni ignores fcntls */
+ /* set asyncronous to avoid blocking on SES_GET_AI */
+ sesopts.io_flags = SES_IO_NBIO + SES_IO_ASYNCH_MODE;
+ sesopts.io_io_signal = SIGIO;
+ sesopts.io_int_signal = 0;
+
+ if (ioctl(fd, SES_IO_TYPE, &sesopts) < 0) {
+ fprintf(stderr,"xscope: dni: ioctl failed\n");
+ exit(-1);
+ }
+
+ /* register as server */
+ if (ioctl(fd, SES_NAME_SERVER, objname) < 0) {
+ fprintf(stderr,"xscope: dni: ioctl failed\n");
+ exit(-1);
+ }
+ debug(4,(stderr, "Listening on DECnet FD %d\n", fd));
+ UsingFD(fd, NewConnection, NULL, NULL);
+}
+#endif
+
+#ifdef DNETSVR4
+short
+initialize_libdni()
+{
+ void *handle;
+ char *home;
+ char *path;
+
+ if (dnet_gethostname && dnet_gethostbyname)
+ return(1);
+ if (!(handle = dlopen("/etc/openwin/lib/libdni.so",RTLD_NOW))) {
+ if ((home = (char *)getenv("DNI_X_ENABLE")) == NULL)
+ return(0);
+ path = (char *)malloc(strlen(home) + 12);
+ sprintf(path, "%s%s",home, "/libdni.so");
+ if (!(handle = dlopen(path,RTLD_NOW)))
+ return(0);
+ free(path);
+ }
+ if (!(dnet_gethostbyname = (struct hostent *(*)())dlsym(handle,"dni_gethostbyname")))
+ return(0);
+ if (!(dnet_gethostname = (int (*)())dlsym(handle,"dni_gethostname")))
+ return(0);
+ return(1);
+}
+#endif
+#endif /* USE_XTRANS */
+
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..fd86a54
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,64 @@
+dnl
+dnl Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+dnl Use subject to license terms.
+dnl
+dnl Permission is hereby granted, free of charge, to any person obtaining a
+dnl copy of this software and associated documentation files (the
+dnl "Software"), to deal in the Software without restriction, including
+dnl without limitation the rights to use, copy, modify, merge, publish,
+dnl distribute, and/or sell copies of the Software, and to permit persons
+dnl to whom the Software is furnished to do so, provided that the above
+dnl copyright notice(s) and this permission notice appear in all copies of
+dnl the Software and that both the above copyright notice(s) and this
+dnl permission notice appear in supporting documentation.
+dnl
+dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+dnl OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+dnl HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+dnl INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+dnl FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+dnl NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+dnl WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+dnl
+dnl Except as contained in this notice, the name of a copyright holder
+dnl shall not be used in advertising or otherwise to promote the sale, use
+dnl or other dealings in this Software without prior written authorization
+dnl of the copyright holder.
+dnl
+dnl
+dnl Process this file with autoconf to create configure.
+
+AC_PREREQ([2.57])
+AC_INIT(xscope,[1.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xscope)
+AM_INIT_AUTOMAKE([dist-bzip2])
+AM_MAINTAINER_MODE
+
+AM_CONFIG_HEADER(config.h)
+
+AC_PROG_CC
+AC_PROG_INSTALL
+
+dnl Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
+dnl was not expanded, since xscope with no transport types is rather useless.
+dnl
+dnl If you're seeing an error here, be sure you installed the lib/xtrans module
+dnl first and if it's not in the default location, that you set the ACLOCAL
+dnl environment variable to find it, such as:
+dnl ACLOCAL="aclocal -I ${PREFIX}/share/aclocal"
+m4_pattern_forbid([XTRANS_CONNECTION_FLAGS])
+
+# Transport selection macro from xtrans.m4
+XTRANS_CONNECTION_FLAGS
+
+# Checks for pkg-config packages
+PKG_CHECK_MODULES(XSCOPE, xtrans)
+XSCOPE_CFLAGS="$XSCOPE_CFLAGS -DUSE_XTRANS"
+AC_SUBST(XSCOPE_CFLAGS)
+AC_SUBST(XSCOPE_LIBS)
+
+XORG_MANPAGE_SECTIONS
+XORG_RELEASE_VERSION
+
+AC_OUTPUT([Makefile])
diff --git a/decode11.c b/decode11.c
index 4a163c1..5cf131a 100644
--- a/decode11.c
+++ b/decode11.c
@@ -23,11 +23,44 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* *
+ * *
+ * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
* ************************************************************ */
#include "scope.h"
#include "x11.h"
+#ifdef SYSV
+#define bzero(s,l) memset(s, 0, l)
+#define bcopy(s,d,l) memmove(d,s,l)
+#endif
+
/*
There are 4 types of things in X11: requests, replies, errors, and events.
@@ -71,7 +104,7 @@ struct QueueEntry
static struct QueueEntry *FreeQEntries = NULL;
/* ************************************************************ */
-struct QueueEntry *NewQEntry (SequenceNumber, Request, RequestMinor)
+static struct QueueEntry *NewQEntry (SequenceNumber, Request, RequestMinor)
long SequenceNumber;
short Request;
short RequestMinor;
@@ -108,10 +141,11 @@ struct QueueHeader
struct QueueEntry *Tail;
};
-struct QueueHeader ReplyQ[StaticMaxFD];
+static struct QueueHeader ReplyQ[StaticMaxFD];
/* ************************************************************ */
+void
InitReplyQ()
{
short i;
@@ -122,6 +156,7 @@ InitReplyQ()
}
}
+void
FlushReplyQ(fd)
FD fd;
{
@@ -142,7 +177,7 @@ FD fd;
ReplyQ[fd].Tail = NULL;
}
-
+static void
DumpReplyQ(fd)
FD fd;
{
@@ -163,6 +198,7 @@ DumpReplyQ(fd)
/* A reply is expected to the type of request given for the fd associated
with this one */
+static void
SequencedReplyExpected(fd, SequenceNumber, RequestType, RequestMinorType)
FD fd;
long SequenceNumber;
@@ -251,6 +287,7 @@ short CheckReplyTable (fd, SequenceNumber, minorp)
/* A reply is expected to the type of request given for the
sequence number associated with this fd */
+void
ReplyExpected(fd, Request)
FD fd;
short Request;
@@ -270,6 +307,7 @@ ExtendedReplyExpected (fd, Request, RequestMinor)
/* another reply is expected for the same reply as we just had */
/* This is only used with ListFontsWithInfo */
+void
KeepLastReplyExpected()
{
SequencedReplyExpected(Lastfd, LastSequenceNumber, LastReplyType,
@@ -333,6 +371,7 @@ extern unsigned char MITSHMEvent;
extern unsigned char LookForBIGREQFlag;
extern unsigned char BIGREQRequest;
+void
DecodeRequest(fd, buf, n)
FD fd;
unsigned char *buf;
@@ -369,7 +408,7 @@ DecodeRequest(fd, buf, n)
return;
}
- if (Verbose > 3)
+ if (Raw || (Verbose > 3))
DumpItem("Request", fd, buf, n);
if (Request < 0 || 127 < Request) {
#ifdef PEX
@@ -833,6 +872,7 @@ DecodeRequest(fd, buf, n)
/* */
/* ************************************************************ */
+void
DecodeReply(fd, buf, n)
FD fd;
unsigned char *buf;
@@ -851,7 +891,7 @@ DecodeReply(fd, buf, n)
SetIndentLevel(PRINTSERVER);
RBf[0] = Request /* for the PrintField in the Reply procedure */ ;
RBf[1] = RequestMinor;
- if (Verbose > 3)
+ if (Raw || (Verbose > 3))
DumpItem("Reply", fd, buf, n);
#ifdef PEX
if (Request == PEXCode)
@@ -1009,6 +1049,7 @@ DecodeReply(fd, buf, n)
/* */
/* ************************************************************ */
+void
DecodeError(fd, buf, n)
FD fd;
unsigned char *buf;
@@ -1027,7 +1068,7 @@ DecodeError(fd, buf, n)
}
SetIndentLevel(PRINTSERVER);
- if (Verbose > 3)
+ if (Raw || (Verbose > 3))
DumpItem("Error", fd, buf, n);
if (Error == LBXError)
@@ -1104,6 +1145,7 @@ DecodeError(fd, buf, n)
/* */
/* ************************************************************ */
+void
DecodeEvent(fd, buf, n)
FD fd;
unsigned char *buf;
@@ -1119,7 +1161,7 @@ DecodeEvent(fd, buf, n)
}
SetIndentLevel(PRINTSERVER);
- if (Verbose > 3)
+ if (Raw || (Verbose > 3))
DumpItem("Event", fd, buf, n);
/* high-order bit means SendEvent generated */
if (Event & 0x80)
diff --git a/fd.c b/fd.c
index 18de19b..af6c79b 100644
--- a/fd.c
+++ b/fd.c
@@ -23,10 +23,45 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* *
+ * *
+ * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
\* *********************************************************** */
#include "scope.h"
+#ifdef SYSV
+#include <unistd.h>
+#define getdtablesize() sysconf(_SC_OPEN_MAX)
+#define bzero(s,l) memset(s, 0, l)
+#define bcopy(s,d,l) memmove(d,s,l)
+#endif
+
#include <sys/uio.h> /* for struct iovec, used by socket.h */
#include <sys/socket.h> /* for AF_INET, SOCK_STREAM, ... */
#include <sys/ioctl.h> /* for FIONCLEX, FIONBIO, ... */
@@ -56,6 +91,7 @@ extern int errno;
/* */
/* ************************************************************ */
+void
InitializeFD()
{
register short i;
@@ -66,6 +102,9 @@ InitializeFD()
MaxFD = _NFILE - 1;
#else
MaxFD = getdtablesize();
+ if (MaxFD > FD_SETSIZE) {
+ MaxFD = FD_SETSIZE;
+ }
#endif
if (MaxFD > StaticMaxFD)
{
@@ -76,14 +115,18 @@ InitializeFD()
/* allocate space for a File Descriptor (FD) Table */
FDD = (struct FDDescriptor *)
Malloc ((long)(MaxFD * sizeof (struct FDDescriptor)));
+ if (FDD == NULL) {
+ panic("Can't allocate memory!");
+ }
+ bzero(FDD, (MaxFD * sizeof (struct FDDescriptor)));
/* be sure all fd's are closed and marked not busy */
for (i = 0; i < MaxFD; i++)
{
/* 0, 1, 2 are special (stdin, stdout, stderr) */
if (i > 2)
- (void)close(i);
- FDD[i].Busy = false;
+ close(i);
+ /* FDD[i].Busy = false; - not needed since false==0*/
}
/* save one FD for single file input or output like debugging */
@@ -94,17 +137,19 @@ InitializeFD()
ReadDescriptors = 0;
HighestFD = 0;
- UsingFD(fileno(stdin), (int (*)())NULL, (int (*)())NULL);
- UsingFD(fileno(stdout), (int (*)())NULL, (int (*)())NULL);
- UsingFD(fileno(stderr), (int (*)())NULL);
+ UsingFD(fileno(stdin), NULL, NULL, NULL);
+ UsingFD(fileno(stdout), NULL, NULL, NULL);
+ UsingFD(fileno(stderr), NULL, NULL, NULL);
}
/* ************************************************************ */
-UsingFD(fd, Handler, FlushHandler)
+void
+UsingFD(fd, Handler, FlushHandler, trans_conn)
FD fd;
- int (*Handler)();
- int (*FlushHandler)();
+ void (*Handler)(int);
+ void (*FlushHandler)(int);
+ XtransConnInfo trans_conn;
{
if (FDD[fd].Busy)
NotUsingFD(fd);
@@ -113,6 +158,9 @@ UsingFD(fd, Handler, FlushHandler)
FDD[fd].Busy = true;
FDD[fd].InputHandler = Handler;
FDD[fd].FlushHandler = FlushHandler;
+#ifdef USE_XTRANS
+ FDD[fd].trans_conn = trans_conn;
+#endif
if (Handler == NULL)
ReadDescriptors &= ~(1 << fd) /* clear fd bit */ ;
else
@@ -129,6 +177,7 @@ UsingFD(fd, Handler, FlushHandler)
/* ************************************************************ */
+void
NotUsingFD(fd)
FD fd;
{
@@ -148,12 +197,27 @@ NotUsingFD(fd)
/* ************************************************************ */
+#ifdef USE_XTRANS
+XtransConnInfo GetXTransConnInfo(FD fd)
+{
+ return FDD[fd].trans_conn;
+}
+#endif
+
+/* ************************************************************ */
+
+static void
EOFonFD(fd)
FD fd;
{
enterprocedure("EOFonFD");
debug(128,(stderr, "EOF on %d\n", fd));
- (void)close(fd);
+#ifdef USE_XTRANS
+ if (FDD[fd].trans_conn)
+ _X11TransClose(FDD[fd].trans_conn);
+ else
+#endif
+ close(fd);
NotUsingFD(fd);
}
@@ -201,12 +265,32 @@ AcceptConnection (ConnectionSocket)
}
FD
-MakeConnection(server, port, report)
+MakeConnection(server, port, report, trans_conn)
char *server;
short port;
int report;
+ XtransConnInfo *trans_conn; /* transport connection object */
{
FD ServerFD;
+#ifdef USE_XTRANS
+ char address[256];
+ int connect_stat;
+ extern long ServerBasePort;
+
+ snprintf (address, sizeof(address), "%s:%d", server, port - ServerBasePort);
+ if ( (*trans_conn = _X11TransOpenCOTSClient(address)) == NULL ) {
+ debug(1,(stderr, "OpenCOTSClient failed\n"));
+ panic("Can't open connection to Server");
+ }
+ if ((connect_stat = _X11TransConnect(*trans_conn,address)) < 0 ) {
+ _X11TransClose(*trans_conn);
+ *trans_conn = NULL;
+ debug(1,(stderr, "TransConnect failed\n"));
+ panic("Can't open connection to Server");
+ }
+
+ ServerFD = _X11TransGetConnectionNumber(*trans_conn);
+#else /* !USE_XTRANS */
char HostName[512];
struct sockaddr_in sin;
struct sockaddr_un sun;
@@ -308,6 +392,7 @@ MakeConnection(server, port, report)
panic("Can't open connection to Server");
}
}
+#endif /* USE_XTRANS */
debug(4,(stderr, "Connect To Server: FD %d\n", ServerFD));
return(ServerFD);
@@ -319,11 +404,11 @@ MakeConnection(server, port, report)
/* */
/* ************************************************************ */
-#include <errno.h> /* for EINTR, EADDRINUSE, ... */
+#include <errno.h> /* for EINTR, EADDRINUSE, ... */
extern int errno;
-
-MainLoop()
+int
+MainLoop(void)
{
enterprocedure("MainLoop");
@@ -409,4 +494,5 @@ MainLoop()
}
}
}
+ return 0;
}
diff --git a/fd.h b/fd.h
index da48544..1efa4f3 100644
--- a/fd.h
+++ b/fd.h
@@ -23,22 +23,64 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* *
+ * *
+ * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
********************************************** */
+#ifndef XSCOPE_FD_H
+#define XSCOPE_FD_H
-/*
+/*
the following structure remembers for each file descriptor its
state. In particular, we need to know if it is busy or free
and if it is in use, by whom.
*/
+#ifdef USE_XTRANS
+#define TRANS_CLIENT
+#define TRANS_SERVER
+#define X11_t
+#include <X11/Xtrans/Xtrans.h>
+#else
+typedef void *XtransConnInfo;
+#endif
+#include <sys/select.h>
typedef int FD;
struct FDDescriptor
{
Boolean Busy;
- int (*InputHandler)();
- int (*FlushHandler)();
+ void (*InputHandler)(int);
+ void (*FlushHandler)(int);
+#ifdef USE_XTRANS
+ XtransConnInfo trans_conn;
+#endif
};
extern struct FDDescriptor *FDD /* array of FD descriptors */ ;
@@ -50,3 +92,17 @@ extern long ReadDescriptors /* bit map of FD's in use -- for select */ ;
extern long WriteDescriptors /* bit map of write blocked FD's -- for select */;
extern long BlockedReadDescriptors /* bit map of FD's blocked from reading */;
extern short HighestFD /* highest FD in use -- for select */ ;
+
+/* need to change the MaxFD to allow larger number of fd's */
+#define StaticMaxFD FD_SETSIZE
+
+extern void InitializeFD(void);
+extern void UsingFD(FD fd, void (*Handler)(int), void (*FlushHandler)(int),
+ XtransConnInfo trans_conn);
+extern void NotUsingFD(FD fd);
+extern int MainLoop(void);
+#ifdef USE_XTRANS
+extern XtransConnInfo GetXTransConnInfo(FD fd);
+#endif
+
+#endif /* XSCOPE_FD_H */
diff --git a/print11.c b/print11.c
index 67a8607..63082dc 100644
--- a/print11.c
+++ b/print11.c
@@ -23,11 +23,43 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* *
+ * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
* ************************************************** */
#include "scope.h"
#include "x11.h"
+static void PrintFailedSetUpReply(unsigned char *buf);
+static void PrintSuccessfulSetUpReply(unsigned char *buf);
+static void ListFontsWithInfoReply1(unsigned char *buf);
+static void ListFontsWithInfoReply2(unsigned char *buf);
+
/* ************************************************************ */
/* */
@@ -63,6 +95,7 @@
/* */
/* ************************************************************ */
+void
PrintSetUpMessage(buf)
unsigned char *buf;
{
@@ -80,10 +113,11 @@ PrintSetUpMessage(buf)
n = IShort(&buf[6]);
printfield(buf, 8, 2, DVALUE2(d), "length of data");
d = IShort(&buf[8]);
- PrintString8(&buf[12], (long)n, "authorization-protocol-name");
- PrintString8(&buf[pad((long)(12+n))], (long)d, "authorization-protocol-data");
+ PrintString8(&buf[12], n, "authorization-protocol-name");
+ PrintString8(&buf[pad((long)(12 + n))], d, "authorization-protocol-data");
}
+void
PrintSetUpReply(buf)
unsigned char *buf;
{
@@ -95,6 +129,7 @@ PrintSetUpReply(buf)
PrintFailedSetUpReply(buf);
}
+static void
PrintFailedSetUpReply(buf)
unsigned char *buf;
{
@@ -108,9 +143,10 @@ PrintFailedSetUpReply(buf)
PrintField(buf, 2, 2, CARD16, "major-version");
PrintField(buf, 4, 2, CARD16, "minor-version");
printfield(buf, 6, 2, DVALUE2((n + p) / 4), "length of data");
- PrintString8(&buf[8], (long)n, "reason");
+ PrintString8(&buf[8], n, "reason");
}
+static void
PrintSuccessfulSetUpReply(buf)
unsigned char *buf;
{
@@ -140,12 +176,11 @@ PrintSuccessfulSetUpReply(buf)
PrintField(buf, 33, 1, CARD8, "bitmap-format-scanline-pad");
PrintField(buf, 34, 1, KEYCODE, "min-keycode");
PrintField(buf, 35, 1, KEYCODE, "max-keycode");
- PrintString8(&buf[40], (long)v, "vendor");
- (void)PrintList(&buf[pad((long)(40+v))], (long)n, FORMAT, "pixmap-formats");
- (void)PrintList(&buf[pad((long)(40+v) + 8 * n)], (long)m, SCREEN, "roots");
+ PrintString8(&buf[40], v, "vendor");
+ PrintList(&buf[pad((long)(40 + v))], (long)n, FORMAT, "pixmap-formats");
+ PrintList(&buf[pad((long)(40 + v) + 8 * n)], (long)m, SCREEN, "roots");
}
-
/* ************************************************************ */
/* */
/* */
@@ -164,6 +199,7 @@ char *REPLYHEADER = "..............REPLY";
/* Error Printing procedures */
+void
RequestError(buf)
unsigned char *buf;
{
@@ -175,6 +211,7 @@ RequestError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
ValueError(buf)
unsigned char *buf;
{
@@ -187,6 +224,7 @@ ValueError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
WindowError(buf)
unsigned char *buf;
{
@@ -199,6 +237,7 @@ WindowError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
PixmapError(buf)
unsigned char *buf;
{
@@ -211,6 +250,7 @@ PixmapError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
AtomError(buf)
unsigned char *buf;
{
@@ -223,6 +263,7 @@ AtomError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
CursorError(buf)
unsigned char *buf;
{
@@ -235,6 +276,7 @@ CursorError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
FontError(buf)
unsigned char *buf;
{
@@ -247,6 +289,7 @@ FontError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
MatchError(buf)
unsigned char *buf;
{
@@ -258,6 +301,7 @@ MatchError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
DrawableError(buf)
unsigned char *buf;
{
@@ -270,6 +314,7 @@ DrawableError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
AccessError(buf)
unsigned char *buf;
{
@@ -281,6 +326,7 @@ AccessError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
AllocError(buf)
unsigned char *buf;
{
@@ -292,6 +338,7 @@ AllocError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
ColormapError(buf)
unsigned char *buf;
{
@@ -304,6 +351,7 @@ ColormapError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
GContextError(buf)
unsigned char *buf;
{
@@ -316,6 +364,7 @@ GContextError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
IDChoiceError(buf)
unsigned char *buf;
{
@@ -328,6 +377,7 @@ IDChoiceError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
NameError(buf)
unsigned char *buf;
{
@@ -339,6 +389,7 @@ NameError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
LengthError(buf)
unsigned char *buf;
{
@@ -350,6 +401,7 @@ LengthError(buf)
PrintField(buf, 10, 1, CARD8, "major opcode");
}
+void
ImplementationError(buf)
unsigned char *buf;
{
@@ -368,6 +420,7 @@ ImplementationError(buf)
/* Event Printing procedures */
+void
KeyPressEvent(buf)
unsigned char *buf;
{
@@ -388,6 +441,7 @@ KeyPressEvent(buf)
PrintField(buf, 30, 1, BOOL, "same-screen");
}
+void
KeyReleaseEvent(buf)
unsigned char *buf;
{
@@ -408,6 +462,7 @@ KeyReleaseEvent(buf)
PrintField(buf, 30, 1, BOOL, "same-screen");
}
+void
ButtonPressEvent(buf)
unsigned char *buf;
{
@@ -428,6 +483,7 @@ ButtonPressEvent(buf)
PrintField(buf, 30, 1, BOOL, "same-screen");
}
+void
ButtonReleaseEvent(buf)
unsigned char *buf;
{
@@ -448,6 +504,7 @@ ButtonReleaseEvent(buf)
PrintField(buf, 30, 1, BOOL, "same-screen");
}
+void
MotionNotifyEvent(buf)
unsigned char *buf;
{
@@ -468,6 +525,7 @@ MotionNotifyEvent(buf)
PrintField(buf, 30, 1, BOOL, "same-screen");
}
+void
EnterNotifyEvent(buf)
unsigned char *buf;
{
@@ -489,6 +547,7 @@ EnterNotifyEvent(buf)
PrintField(buf, 31, 1, SCREENFOCUS, "same-screen, focus");
}
+void
LeaveNotifyEvent(buf)
unsigned char *buf;
{
@@ -510,6 +569,7 @@ LeaveNotifyEvent(buf)
PrintField(buf, 31, 1, SCREENFOCUS, "same-screen, focus");
}
+void
FocusInEvent(buf)
unsigned char *buf;
{
@@ -522,6 +582,7 @@ FocusInEvent(buf)
PrintField(buf, 8, 1, BUTTONMODE, "mode");
}
+void
FocusOutEvent(buf)
unsigned char *buf;
{
@@ -534,6 +595,7 @@ FocusOutEvent(buf)
PrintField(buf, 8, 1, BUTTONMODE, "mode");
}
+void
KeymapNotifyEvent(buf)
unsigned char *buf;
{
@@ -543,6 +605,7 @@ KeymapNotifyEvent(buf)
PrintBytes(&buf[1], (long)31,"keys");
}
+void
ExposeEvent(buf)
unsigned char *buf;
{
@@ -558,6 +621,7 @@ ExposeEvent(buf)
PrintField(buf, 16, 2, CARD16, "count");
}
+void
GraphicsExposureEvent(buf)
unsigned char *buf;
{
@@ -575,6 +639,7 @@ GraphicsExposureEvent(buf)
PrintField(buf, 20, 1, CARD8, "major-opcode");
}
+void
NoExposureEvent(buf)
unsigned char *buf;
{
@@ -587,6 +652,7 @@ NoExposureEvent(buf)
PrintField(buf, 10, 1, CARD8, "major-opcode");
}
+void
VisibilityNotifyEvent(buf)
unsigned char *buf;
{
@@ -598,6 +664,7 @@ VisibilityNotifyEvent(buf)
PrintField(buf, 8, 1, VISIBLE, "state");
}
+void
CreateNotifyEvent(buf)
unsigned char *buf;
{
@@ -615,6 +682,7 @@ CreateNotifyEvent(buf)
PrintField(buf, 22, 1, BOOL, "override-redirect");
}
+void
DestroyNotifyEvent(buf)
unsigned char *buf;
{
@@ -626,6 +694,7 @@ DestroyNotifyEvent(buf)
PrintField(buf, 8, 4, WINDOW, "window");
}
+void
UnmapNotifyEvent(buf)
unsigned char *buf;
{
@@ -638,6 +707,7 @@ UnmapNotifyEvent(buf)
PrintField(buf, 12, 1, BOOL, "from-configure");
}
+void
MapNotifyEvent(buf)
unsigned char *buf;
{
@@ -650,6 +720,7 @@ MapNotifyEvent(buf)
PrintField(buf, 12, 1, BOOL, "override-redirect");
}
+void
MapRequestEvent(buf)
unsigned char *buf;
{
@@ -661,6 +732,7 @@ MapRequestEvent(buf)
PrintField(buf, 8, 4, WINDOW, "window");
}
+void
ReparentNotifyEvent(buf)
unsigned char *buf;
{
@@ -676,6 +748,7 @@ ReparentNotifyEvent(buf)
PrintField(buf, 20, 1, BOOL, "override-redirect");
}
+void
ConfigureNotifyEvent(buf)
unsigned char *buf;
{
@@ -694,6 +767,7 @@ ConfigureNotifyEvent(buf)
PrintField(buf, 26, 1, BOOL, "override-redirect");
}
+void
ConfigureRequestEvent(buf)
unsigned char *buf;
{
@@ -713,6 +787,7 @@ ConfigureRequestEvent(buf)
PrintField(buf, 26, 2, CONFIGURE_BITMASK, "value-mask");
}
+void
GravityNotifyEvent(buf)
unsigned char *buf;
{
@@ -726,6 +801,7 @@ GravityNotifyEvent(buf)
PrintField(buf, 14, 2, INT16, "y");
}
+void
ResizeRequestEvent(buf)
unsigned char *buf;
{
@@ -738,6 +814,7 @@ ResizeRequestEvent(buf)
PrintField(buf, 10, 2, CARD16, "height");
}
+void
CirculateNotifyEvent(buf)
unsigned char *buf;
{
@@ -751,6 +828,7 @@ CirculateNotifyEvent(buf)
PrintField(buf, 16, 1, CIRSTAT, "place");
}
+void
CirculateRequestEvent(buf)
unsigned char *buf;
{
@@ -763,6 +841,7 @@ CirculateRequestEvent(buf)
PrintField(buf, 16, 1, CIRSTAT, "place");
}
+void
PropertyNotifyEvent(buf)
unsigned char *buf;
{
@@ -776,6 +855,7 @@ PropertyNotifyEvent(buf)
PrintField(buf, 16, 1, PROPCHANGE, "state");
}
+void
SelectionClearEvent(buf)
unsigned char *buf;
{
@@ -788,6 +868,7 @@ SelectionClearEvent(buf)
PrintField(buf, 12, 4, ATOM, "selection");
}
+void
SelectionRequestEvent(buf)
unsigned char *buf;
{
@@ -803,6 +884,7 @@ SelectionRequestEvent(buf)
PrintField(buf, 24, 4, ATOM, "property");
}
+void
SelectionNotifyEvent(buf)
unsigned char *buf;
{
@@ -817,6 +899,7 @@ SelectionNotifyEvent(buf)
PrintField(buf, 20, 4, ATOM, "property");
}
+void
ColormapNotifyEvent(buf)
unsigned char *buf;
{
@@ -830,31 +913,21 @@ ColormapNotifyEvent(buf)
PrintField(buf, 13, 1, CMAPCHANGE, "state");
}
+void
ClientMessageEvent(buf)
unsigned char *buf;
{
- short format;
- long type;
-
PrintField(buf, 0, 1, EVENT, EVENTHEADER) /* ClientMessage */ ;
if (Verbose < 1)
return;
PrintField(buf, 1, 1, CARD8, "format");
- format = IByte(&buf[1]);
printfield(buf, 2, 2, CARD16, "sequence number");
PrintField(buf, 4, 4, WINDOW, "window");
PrintField(buf, 8, 4, ATOM, "type");
- type = ILong(&buf[8]);
- if (type == 31 /* string */)
- PrintString8(&buf[12], 20L, "data");
- else if (format == 16)
- (void)PrintList(&buf[12], 10L, INT16, "data");
- else if (format == 32)
- (void)PrintList(&buf[12], 5L, INT32, "data");
- else
- PrintBytes(&buf[12], 20L, "data");
+ PrintBytes(&buf[12], (long)20,"data");
}
+void
MappingNotifyEvent(buf)
unsigned char *buf;
{
@@ -903,6 +976,7 @@ UnknownReply(buf)
(void) PrintList (&buf[8], n, CARD32, "data");
}
+void
CreateWindow(buf)
unsigned char *buf;
{
@@ -928,6 +1002,7 @@ CreateWindow(buf)
PrintValues(&buf[28], 4, WINDOW_BITMASK, &buf[32], "value-list");
}
+void
ChangeWindowAttributes(buf)
unsigned char *buf;
{
@@ -944,6 +1019,7 @@ ChangeWindowAttributes(buf)
PrintValues(&buf[8], 4, WINDOW_BITMASK, &buf[12], "value-list");
}
+void
GetWindowAttributes(buf)
unsigned char *buf;
{
@@ -958,6 +1034,7 @@ GetWindowAttributes(buf)
PrintField(buf, 4, 4, WINDOW, "window");
}
+void
GetWindowAttributesReply(buf)
unsigned char *buf;
{
@@ -983,6 +1060,7 @@ GetWindowAttributesReply(buf)
PrintField(buf, 40, 2, SETofDEVICEEVENT, "do-not-propagate-mask");
}
+void
DestroyWindow(buf)
unsigned char *buf;
{
@@ -997,6 +1075,7 @@ DestroyWindow(buf)
PrintField(buf, 4, 4, WINDOW, "window");
}
+void
DestroySubwindows(buf)
unsigned char *buf;
{
@@ -1011,6 +1090,7 @@ DestroySubwindows(buf)
PrintField(buf, 4, 4, WINDOW, "window");
}
+void
ChangeSaveSet(buf)
unsigned char *buf;
{
@@ -1026,6 +1106,7 @@ ChangeSaveSet(buf)
PrintField(buf, 4, 4, WINDOW, "window");
}
+void
ReparentWindow(buf)
unsigned char *buf;
{
@@ -1043,6 +1124,7 @@ ReparentWindow(buf)
PrintField(buf, 14, 2, INT16, "y");
}
+void
MapWindow(buf)
unsigned char *buf;
{
@@ -1057,6 +1139,7 @@ MapWindow(buf)
PrintField(buf, 4, 4, WINDOW, "window");
}
+void
MapSubwindows(buf)
unsigned char *buf;
{
@@ -1071,6 +1154,7 @@ MapSubwindows(buf)
PrintField(buf, 4, 4, WINDOW, "window");
}
+void
UnmapWindow(buf)
unsigned char *buf;
{
@@ -1085,6 +1169,7 @@ UnmapWindow(buf)
PrintField(buf, 4, 4, WINDOW, "window");
}
+void
UnmapSubwindows(buf)
unsigned char *buf;
{
@@ -1099,6 +1184,7 @@ UnmapSubwindows(buf)
PrintField(buf, 4, 4, WINDOW, "window");
}
+void
ConfigureWindow(buf)
unsigned char *buf;
{
@@ -1115,6 +1201,7 @@ ConfigureWindow(buf)
PrintValues(&buf[8], 2, CONFIGURE_BITMASK, &buf[12], "value-list");
}
+void
CirculateWindow(buf)
unsigned char *buf;
{
@@ -1130,6 +1217,7 @@ CirculateWindow(buf)
PrintField(buf, 4, 4, WINDOW, "window");
}
+void
GetGeometry(buf)
unsigned char *buf;
{
@@ -1144,6 +1232,7 @@ GetGeometry(buf)
PrintField(buf, 4, 4, DRAWABLE, "drawable");
}
+void
GetGeometryReply(buf)
unsigned char *buf;
{
@@ -1161,6 +1250,7 @@ GetGeometryReply(buf)
PrintField(buf, 20, 2, CARD16, "border-width");
}
+void
QueryTree(buf)
unsigned char *buf;
{
@@ -1175,6 +1265,7 @@ QueryTree(buf)
PrintField(buf, 4, 4, WINDOW, "window");
}
+void
QueryTreeReply(buf)
unsigned char *buf;
{
@@ -1188,9 +1279,10 @@ QueryTreeReply(buf)
PrintField(buf, 12, 4, WINDOW, "parent");
printfield(buf, 16, 2, DVALUE2(n), "number of children");
n = IShort(&buf[16]);
- (void)PrintList(&buf[32], (long)n, WINDOW, "children");
+ PrintList(&buf[32], (long)n, WINDOW, "children");
}
+void
InternAtom(buf)
unsigned char *buf;
{
@@ -1206,9 +1298,10 @@ InternAtom(buf)
printfield(buf, 2, 2, DVALUE2(2 + (n + p) / 4), "request length");
printfield(buf, 4, 2, DVALUE2(n), "length of name");
n = IShort(&buf[4]);
- PrintString8(&buf[8], (long)n, "name");
+ PrintString8(&buf[8], n, "name");
}
+void
InternAtomReply(buf)
unsigned char *buf;
{
@@ -1220,6 +1313,7 @@ InternAtomReply(buf)
PrintField(buf, 8, 4, ATOM, "atom");
}
+void
GetAtomName(buf)
unsigned char *buf;
{
@@ -1234,6 +1328,7 @@ GetAtomName(buf)
PrintField(buf, 4, 4, ATOM, "atom");
}
+void
GetAtomNameReply(buf)
unsigned char *buf;
{
@@ -1245,14 +1340,15 @@ GetAtomNameReply(buf)
printfield(buf, 4, 4, DVALUE4((n + p) / 4), "reply length");
printfield(buf, 8, 2, DVALUE2(n), "length of name");
n = IShort(&buf[8]);
- PrintString8(&buf[32], (long)n, "name");
+ PrintString8(&buf[32], n, "name");
}
+void
ChangeProperty(buf)
unsigned char *buf;
{
long n;
- short format;
+ short unit;
long type;
/* Request ChangeProperty is opcode 18 */
@@ -1269,19 +1365,16 @@ ChangeProperty(buf)
PrintField(buf, 12, 4, ATOM, "type");
type = ILong(&buf[12]);
PrintField(buf, 16, 1, CARD8, "format");
- format = IByte(&buf[16]);
+ unit = IByte(&buf[16]) / 8;
printfield(buf, 20, 4, CARD32, "length of data");
n = ILong(&buf[20]);
if (type == 31 /* string */)
- PrintString8(&buf[24], n * format/8, "data");
- else if (format == 16)
- (void)PrintList(&buf[24], n, INT16, "data");
- else if (format == 32)
- (void)PrintList(&buf[24], n, INT32, "data");
+ PrintString8(&buf[24], n * unit, "data");
else
- PrintBytes(&buf[24], n * format/8, "data");
+ PrintBytes(&buf[24], n * unit, "data");
}
+void
DeleteProperty(buf)
unsigned char *buf;
{
@@ -1297,6 +1390,7 @@ DeleteProperty(buf)
PrintField(buf, 8, 4, ATOM, "property");
}
+void
GetProperty(buf)
unsigned char *buf;
{
@@ -1316,18 +1410,19 @@ GetProperty(buf)
printfield(buf, 20, 4, CARD32, "long-length");
}
+void
GetPropertyReply(buf)
unsigned char *buf;
{
long n;
- short format;
+ short unit;
long type;
PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* GetProperty */ ;
if (Verbose < 1)
return;
PrintField(buf, 1, 1, CARD8, "format");
- format = IByte(&buf[1]);
+ unit = IByte(&buf[1]) / 8;
printfield(buf, 2, 2, CARD16, "sequence number");
printfield(buf, 4, 4, DVALUE4((n + p) / 4), "reply length");
PrintField(buf, 8, 4, ATOM, "type");
@@ -1336,15 +1431,12 @@ GetPropertyReply(buf)
printfield(buf, 16, 4, CARD32, "length of value");
n = ILong(&buf[16]);
if (type == 31 /* string */)
- PrintString8(&buf[32], n * format/8, "value");
- else if (format == 16)
- (void)PrintList(&buf[32], n, INT16, "value");
- else if (format == 32)
- (void)PrintList(&buf[32], n, INT32, "value");
+ PrintString8(&buf[32], n * unit, "value");
else
- PrintBytes(&buf[32], n * format/8, "value");
+ PrintBytes(&buf[32], n * unit, "value");
}
+void
ListProperties(buf)
unsigned char *buf;
{
@@ -1359,6 +1451,7 @@ ListProperties(buf)
PrintField(buf, 4, 4, WINDOW, "window");
}
+void
ListPropertiesReply(buf)
unsigned char *buf;
{
@@ -1370,9 +1463,10 @@ ListPropertiesReply(buf)
printfield(buf, 4, 4, DVALUE4(n), "reply length");
printfield(buf, 8, 2, DVALUE2(n), "number of atoms");
n = IShort(&buf[8]);
- (void)PrintList(&buf[32], (long)n, ATOM, "atoms");
+ PrintList(&buf[32], (long)n, ATOM, "atoms");
}
+void
SetSelectionOwner(buf)
unsigned char *buf;
{
@@ -1389,6 +1483,7 @@ SetSelectionOwner(buf)
PrintField(buf, 12, 4, TIMESTAMP, "time");
}
+void
GetSelectionOwner(buf)
unsigned char *buf;
{
@@ -1403,6 +1498,7 @@ GetSelectionOwner(buf)
PrintField(buf, 4, 4, ATOM, "selection");
}
+void
GetSelectionOwnerReply(buf)
unsigned char *buf;
{
@@ -1414,6 +1510,7 @@ GetSelectionOwnerReply(buf)
PrintField(buf, 8, 4, WINDOW, "owner");
}
+void
ConvertSelection(buf)
unsigned char *buf;
{
@@ -1432,6 +1529,7 @@ ConvertSelection(buf)
PrintField(buf, 20, 4, TIMESTAMP, "time");
}
+void
SendEvent(buf)
unsigned char *buf;
{
@@ -1449,6 +1547,7 @@ SendEvent(buf)
PrintField(buf, 12, 32, EVENTFORM, "event");
}
+void
GrabPointer(buf)
unsigned char *buf;
{
@@ -1470,6 +1569,7 @@ GrabPointer(buf)
PrintField(buf, 20, 4, TIMESTAMP, "time");
}
+void
GrabPointerReply(buf)
unsigned char *buf;
{
@@ -1481,6 +1581,7 @@ GrabPointerReply(buf)
printfield(buf, 4, 4, CONST4(0), "reply length");
}
+void
UngrabPointer(buf)
unsigned char *buf;
{
@@ -1495,6 +1596,7 @@ UngrabPointer(buf)
PrintField(buf, 4, 4, TIMESTAMP, "time");
}
+void
GrabButton(buf)
unsigned char *buf;
{
@@ -1517,6 +1619,7 @@ GrabButton(buf)
PrintField(buf, 22, 2, SETofKEYMASK, "modifiers");
}
+void
UngrabButton(buf)
unsigned char *buf;
{
@@ -1533,6 +1636,7 @@ UngrabButton(buf)
PrintField(buf, 8, 2, SETofKEYMASK, "modifiers");
}
+void
ChangeActivePointerGrab(buf)
unsigned char *buf;
{
@@ -1549,6 +1653,7 @@ ChangeActivePointerGrab(buf)
PrintField(buf, 12, 2, SETofPOINTEREVENT, "event-mask");
}
+void
GrabKeyboard(buf)
unsigned char *buf;
{
@@ -1567,6 +1672,7 @@ GrabKeyboard(buf)
PrintField(buf, 13, 1, PK_MODE, "keyboard-mode");
}
+void
GrabKeyboardReply(buf)
unsigned char *buf;
{
@@ -1578,6 +1684,7 @@ GrabKeyboardReply(buf)
printfield(buf, 4, 4, CONST4(0), "reply length");
}
+void
UngrabKeyboard(buf)
unsigned char *buf;
{
@@ -1592,6 +1699,7 @@ UngrabKeyboard(buf)
PrintField(buf, 4, 4, TIMESTAMP, "time");
}
+void
GrabKey(buf)
unsigned char *buf;
{
@@ -1611,6 +1719,7 @@ GrabKey(buf)
PrintField(buf, 12, 1, PK_MODE, "keyboard-mode");
}
+void
UngrabKey(buf)
unsigned char *buf;
{
@@ -1627,6 +1736,7 @@ UngrabKey(buf)
PrintField(buf, 8, 2, SETofKEYMASK, "modifiers");
}
+void
AllowEvents(buf)
unsigned char *buf;
{
@@ -1642,6 +1752,7 @@ AllowEvents(buf)
PrintField(buf, 4, 4, TIMESTAMP, "time");
}
+void
GrabServer(buf)
unsigned char *buf;
{
@@ -1655,6 +1766,7 @@ GrabServer(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
UngrabServer(buf)
unsigned char *buf;
{
@@ -1668,6 +1780,7 @@ UngrabServer(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
QueryPointer(buf)
unsigned char *buf;
{
@@ -1682,6 +1795,7 @@ QueryPointer(buf)
PrintField(buf, 4, 4, WINDOW, "window");
}
+void
QueryPointerReply(buf)
unsigned char *buf;
{
@@ -1700,6 +1814,7 @@ QueryPointerReply(buf)
PrintField(buf, 24, 2, SETofKEYBUTMASK, "mask");
}
+void
GetMotionEvents(buf)
unsigned char *buf;
{
@@ -1716,6 +1831,7 @@ GetMotionEvents(buf)
PrintField(buf, 12, 4, TIMESTAMP, "stop");
}
+void
GetMotionEventsReply(buf)
unsigned char *buf;
{
@@ -1727,9 +1843,10 @@ GetMotionEventsReply(buf)
printfield(buf, 4, 4, DVALUE4(2*n), "reply length");
printfield(buf, 8, 4, DVALUE4(n), "number of events");
n = ILong(&buf[8]);
- (void)PrintList(&buf[32], n, TIMECOORD, "events");
+ PrintList(&buf[32], n, TIMECOORD, "events");
}
+void
TranslateCoordinates(buf)
unsigned char *buf;
{
@@ -1747,6 +1864,7 @@ TranslateCoordinates(buf)
PrintField(buf, 14, 2, INT16, "src-y");
}
+void
TranslateCoordinatesReply(buf)
unsigned char *buf;
{
@@ -1761,6 +1879,7 @@ TranslateCoordinatesReply(buf)
PrintField(buf, 14, 2, INT16, "dst-y");
}
+void
WarpPointer(buf)
unsigned char *buf;
{
@@ -1782,6 +1901,7 @@ WarpPointer(buf)
PrintField(buf, 22, 2, INT16, "dst-y");
}
+void
SetInputFocus(buf)
unsigned char *buf;
{
@@ -1798,6 +1918,7 @@ SetInputFocus(buf)
PrintField(buf, 8, 4, TIMESTAMP, "time");
}
+void
GetInputFocus(buf)
unsigned char *buf;
{
@@ -1811,6 +1932,7 @@ GetInputFocus(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
GetInputFocusReply(buf)
unsigned char *buf;
{
@@ -1823,6 +1945,7 @@ GetInputFocusReply(buf)
PrintField(buf, 8, 4, WINDOWNR, "focus");
}
+void
QueryKeymap(buf)
unsigned char *buf;
{
@@ -1836,6 +1959,7 @@ QueryKeymap(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
QueryKeymapReply(buf)
unsigned char *buf;
{
@@ -1847,11 +1971,11 @@ QueryKeymapReply(buf)
PrintBytes(&buf[8], 32L, "keys");
}
+void
OpenFont(buf)
unsigned char *buf;
{
short n;
-
/* Request OpenFont is opcode 45 */
PrintField(buf, 0, 1, REQUEST, REQUESTHEADER) /* OpenFont */ ;
if (Verbose < 1)
@@ -1863,9 +1987,10 @@ OpenFont(buf)
PrintField(buf, 4, 4, FONT, "font-id");
printfield(buf, 8, 2, DVALUE2(n), "length of name");
n = IShort(&buf[8]);
- PrintString8(&buf[12], (long)n, "name");
+ PrintString8(&buf[12], n, "name");
}
+void
CloseFont(buf)
unsigned char *buf;
{
@@ -1880,6 +2005,7 @@ CloseFont(buf)
PrintField(buf, 4, 4, FONT, "font");
}
+void
QueryFont(buf)
unsigned char *buf;
{
@@ -1894,6 +2020,7 @@ QueryFont(buf)
PrintField(buf, 4, 4, FONTABLE, "font");
}
+void
QueryFontReply(buf)
unsigned char *buf;
{
@@ -1922,9 +2049,10 @@ QueryFontReply(buf)
printfield(buf, 56, 4, DVALUE4(m), "number of CHARINFOs");
m = ILong(&buf[56]);
k = PrintList(&buf[60], (long)n, FONTPROP, "properties");
- (void)PrintList(&buf[60 + k], (long)m, CHARINFO, "char-infos");
+ PrintList(&buf[60 + k], (long)m, CHARINFO, "char-infos");
}
+void
QueryTextExtents(buf)
unsigned char *buf;
{
@@ -1943,9 +2071,10 @@ QueryTextExtents(buf)
if (IBool(&buf[1]))
n -= 1;
PrintField(buf, 4, 4, FONTABLE, "font");
- PrintString16(&buf[8], (long)n, "string");
+ PrintString16(&buf[8], n, "string");
}
+void
QueryTextExtentsReply(buf)
unsigned char *buf;
{
@@ -1964,11 +2093,11 @@ QueryTextExtentsReply(buf)
PrintField(buf, 24, 4, INT32, "overall-right");
}
+void
ListFonts(buf)
unsigned char *buf;
{
short n;
-
/* Request ListFonts is opcode 49 */
PrintField(buf, 0, 1, REQUEST, REQUESTHEADER) /* ListFonts */ ;
if (Verbose < 1)
@@ -1980,9 +2109,10 @@ ListFonts(buf)
PrintField(buf, 4, 2, CARD16, "max-names");
printfield(buf, 6, 2, DVALUE2(n), "length of pattern");
n = IShort(&buf[6]);
- PrintString8(&buf[8], (long)n, "pattern");
+ PrintString8(&buf[8], n, "pattern");
}
+void
ListFontsReply(buf)
unsigned char *buf;
{
@@ -1998,11 +2128,11 @@ ListFontsReply(buf)
PrintListSTR(&buf[32], (long)n, "names");
}
+void
ListFontsWithInfo(buf)
unsigned char *buf;
{
short n;
-
/* Request ListFontsWithInfo is opcode 50 */
PrintField(buf, 0, 1, REQUEST, REQUESTHEADER) /* ListFontsWithInfo */ ;
if (Verbose < 1)
@@ -2014,9 +2144,10 @@ ListFontsWithInfo(buf)
PrintField(buf, 4, 2, CARD16, "max-names");
printfield(buf, 6, 2, DVALUE2(n), "length of pattern");
n = IShort(&buf[6]);
- PrintString8(&buf[8], (long)n, "pattern");
+ PrintString8(&buf[8], n, "pattern");
}
+void
ListFontsWithInfoReply(buf)
unsigned char *buf;
{
@@ -2030,10 +2161,12 @@ ListFontsWithInfoReply(buf)
ListFontsWithInfoReply1(buf);
KeepLastReplyExpected();
}
+
else
ListFontsWithInfoReply2(buf);
}
+static void
ListFontsWithInfoReply1(buf)
unsigned char *buf;
{
@@ -2057,10 +2190,11 @@ ListFontsWithInfoReply1(buf)
PrintField(buf, 52, 2, INT16, "font-ascent");
PrintField(buf, 54, 2, INT16, "font-descent");
PrintField(buf, 56, 4, CARD32, "replies-hint");
- (void)PrintList(&buf[60], (long)m, FONTPROP, "properties");
- PrintString8(&buf[60 + 8 * m], (long)n, "name");
+ PrintList(&buf[60], (long)m, FONTPROP, "properties");
+ PrintString8(&buf[60 + 8 * m], n, "name");
}
+static void
ListFontsWithInfoReply2(buf)
unsigned char *buf;
{
@@ -2069,6 +2203,7 @@ ListFontsWithInfoReply2(buf)
printfield(buf, 4, 4, CONST4(7), "reply length");
}
+void
SetFontPath(buf)
unsigned char *buf;
{
@@ -2086,6 +2221,7 @@ SetFontPath(buf)
PrintListSTR(&buf[8], (long)n, "paths");
}
+void
GetFontPath(buf)
unsigned char *buf;
{
@@ -2099,6 +2235,7 @@ GetFontPath(buf)
PrintField(buf, 2, 2, CONST2(1), "request list");
}
+void
GetFontPathReply(buf)
unsigned char *buf;
{
@@ -2113,6 +2250,7 @@ GetFontPathReply(buf)
PrintListSTR(&buf[32], (long)n, "paths");
}
+void
CreatePixmap(buf)
unsigned char *buf;
{
@@ -2131,6 +2269,7 @@ CreatePixmap(buf)
PrintField(buf, 14, 2, CARD16, "height");
}
+void
FreePixmap(buf)
unsigned char *buf;
{
@@ -2171,6 +2310,7 @@ unsigned long GCDefaults[] = {
1, /* arc mode PieSlice */
};
+void
CreateGC(buf)
unsigned char *buf;
{
@@ -2191,6 +2331,7 @@ CreateGC(buf)
PrintValues(&buf[12], 4, GC_BITMASK, &buf[16], "value-list");
}
+void
ChangeGC(buf)
unsigned char *buf;
{
@@ -2209,6 +2350,7 @@ ChangeGC(buf)
PrintValues(&buf[8], 4, GC_BITMASK, &buf[12], "value-list");
}
+void
CopyGC(buf)
unsigned char *buf;
{
@@ -2225,6 +2367,7 @@ CopyGC(buf)
PrintField(buf, 12, 4, GC_BITMASK, "value-mask");
}
+void
SetDashes(buf)
unsigned char *buf;
{
@@ -2244,6 +2387,7 @@ SetDashes(buf)
PrintBytes(&buf[12], (long)n, "dashes");
}
+void
SetClipRectangles(buf)
unsigned char *buf;
{
@@ -2262,9 +2406,10 @@ SetClipRectangles(buf)
PrintField(buf, 4, 4, GCONTEXT, "gc");
PrintField(buf, 8, 2, INT16, "clip-x-origin");
PrintField(buf, 10, 2, INT16, "clip-y-origin");
- (void)PrintList(&buf[12], (long)n, RECTANGLE, "rectangles");
+ PrintList(&buf[12], (long)n, RECTANGLE, "rectangles");
}
+void
FreeGC(buf)
unsigned char *buf;
{
@@ -2281,6 +2426,7 @@ FreeGC(buf)
PrintField(buf, 4, 4, GCONTEXT, "gc");
}
+void
ClearArea(buf)
unsigned char *buf;
{
@@ -2300,6 +2446,7 @@ ClearArea(buf)
PrintField(buf, 14, 2, CARD16, "height");
}
+void
CopyArea(buf)
unsigned char *buf;
{
@@ -2328,6 +2475,7 @@ CopyArea(buf)
PrintField(buf, 26, 2, CARD16, "height");
}
+void
CopyPlane(buf)
unsigned char *buf;
{
@@ -2359,6 +2507,7 @@ CopyPlane(buf)
PrintField(buf, 28, 4, CARD32, "bit-plane");
}
+void
PolyPoint(buf)
unsigned char *buf;
{
@@ -2384,6 +2533,7 @@ PolyPoint(buf)
(void)PrintList(&buf[12], (long)n, POINT, "points");
}
+void
PolyLine(buf)
unsigned char *buf;
{
@@ -2417,6 +2567,7 @@ PolyLine(buf)
(void)PrintList(&buf[12], (long)n, POINT, "points");
}
+void
PolySegment(buf)
unsigned char *buf;
{
@@ -2448,6 +2599,7 @@ PolySegment(buf)
(void)PrintList(&buf[12], (long)n, SEGMENT, "segments");
}
+void
PolyRectangle(buf)
unsigned char *buf;
{
@@ -2480,6 +2632,7 @@ PolyRectangle(buf)
(void)PrintList(&buf[12], (long)n, RECTANGLE, "rectangles");
}
+void
PolyArc(buf)
unsigned char *buf;
{
@@ -2512,6 +2665,7 @@ PolyArc(buf)
(void)PrintList(&buf[12], (long)n, ARC, "arcs");
}
+void
FillPoly(buf)
unsigned char *buf;
{
@@ -2540,9 +2694,10 @@ FillPoly(buf)
GC_BITMASK);
PrintField(buf, 12, 1, POLYSHAPE, "shape");
PrintField(buf, 13, 1, COORMODE, "coordinate-mode");
- (void)PrintList(&buf[16], (long)n, POINT, "points");
+ PrintList(&buf[16], (long)n, POINT, "points");
}
+void
PolyFillRectangle(buf)
unsigned char *buf;
{
@@ -2571,6 +2726,7 @@ PolyFillRectangle(buf)
(void)PrintList(&buf[12], (long)n, RECTANGLE, "rectangles");
}
+void
PolyFillArc(buf)
unsigned char *buf;
{
@@ -2600,6 +2756,7 @@ PolyFillArc(buf)
(void)PrintList(&buf[12], (long)n, ARC, "arcs");
}
+void
PutImage(buf)
unsigned char *buf;
{
@@ -2646,6 +2803,7 @@ PutImage(buf)
PrintBytes(&buf[24], (long)n, "data");
}
+void
GetImage(buf)
unsigned char *buf;
{
@@ -2666,6 +2824,7 @@ GetImage(buf)
PrintField(buf, 16, 4, CARD32, "plane-mask");
}
+void
GetImageReply(buf)
unsigned char *buf;
{
@@ -2687,6 +2846,7 @@ GetImageReply(buf)
PrintBytes(&buf[32], n, "data");
}
+void
PolyText8(buf)
unsigned char *buf;
{
@@ -2719,6 +2879,7 @@ PolyText8(buf)
PrintTextList8(&buf[16], n, "items");
}
+void
PolyText16(buf)
unsigned char *buf;
{
@@ -2751,6 +2912,7 @@ PolyText16(buf)
PrintTextList16(&buf[16], n, "items");
}
+void
ImageText8(buf)
unsigned char *buf;
{
@@ -2779,6 +2941,7 @@ ImageText8(buf)
PrintTString8(&buf[16], (long)n, "string");
}
+void
ImageText16(buf)
unsigned char *buf;
{
@@ -2807,6 +2970,7 @@ ImageText16(buf)
PrintTString16(&buf[16], (long)n, "string");
}
+void
CreateColormap(buf)
unsigned char *buf;
{
@@ -2824,6 +2988,7 @@ CreateColormap(buf)
PrintField(buf, 12, 4, VISUALID, "visual");
}
+void
FreeColormap(buf)
unsigned char *buf;
{
@@ -2838,6 +3003,7 @@ FreeColormap(buf)
PrintField(buf, 4, 4, COLORMAP, "cmap");
}
+void
CopyColormapAndFree(buf)
unsigned char *buf;
{
@@ -2853,6 +3019,7 @@ CopyColormapAndFree(buf)
PrintField(buf, 8, 4, COLORMAP, "src-cmap");
}
+void
InstallColormap(buf)
unsigned char *buf;
{
@@ -2867,6 +3034,7 @@ InstallColormap(buf)
PrintField(buf, 4, 4, COLORMAP, "cmap");
}
+void
UninstallColormap(buf)
unsigned char *buf;
{
@@ -2881,6 +3049,7 @@ UninstallColormap(buf)
PrintField(buf, 4, 4, COLORMAP, "cmap");
}
+void
ListInstalledColormaps(buf)
unsigned char *buf;
{
@@ -2895,6 +3064,7 @@ ListInstalledColormaps(buf)
PrintField(buf, 4, 4, WINDOW, "window");
}
+void
ListInstalledColormapsReply(buf)
unsigned char *buf;
{
@@ -2906,9 +3076,10 @@ ListInstalledColormapsReply(buf)
printfield(buf, 4, 4, DVALUE4(n), "reply length");
printfield(buf, 8, 2, DVALUE2(n), "number of cmaps");
n = IShort(&buf[8]);
- (void)PrintList(&buf[32], (long)n, COLORMAP, "cmaps");
+ PrintList(&buf[32], (long)n, COLORMAP, "cmaps");
}
+void
AllocColor(buf)
unsigned char *buf;
{
@@ -2926,6 +3097,7 @@ AllocColor(buf)
PrintField(buf, 12, 2, CARD16, "blue");
}
+void
AllocColorReply(buf)
unsigned char *buf;
{
@@ -2940,6 +3112,7 @@ AllocColorReply(buf)
PrintField(buf, 16, 4, CARD32, "pixel");
}
+void
AllocNamedColor(buf)
unsigned char *buf;
{
@@ -2955,9 +3128,10 @@ AllocNamedColor(buf)
PrintField(buf, 4, 4, COLORMAP, "cmap");
printfield(buf, 8, 2, DVALUE2(n), "length of name");
n = IShort(&buf[8]);
- PrintString8(&buf[12], (long)n, "name");
+ PrintString8(&buf[12], n, "name");
}
+void
AllocNamedColorReply(buf)
unsigned char *buf;
{
@@ -2975,6 +3149,7 @@ AllocNamedColorReply(buf)
PrintField(buf, 22, 2, CARD16, "visual-blue");
}
+void
AllocColorCells(buf)
unsigned char *buf;
{
@@ -2992,6 +3167,7 @@ AllocColorCells(buf)
PrintField(buf, 10, 2, CARD16, "planes");
}
+void
AllocColorCellsReply(buf)
unsigned char *buf;
{
@@ -3008,9 +3184,10 @@ AllocColorCellsReply(buf)
printfield(buf, 10, 2, DVALUE2(m), "number of masks");
m = IShort(&buf[10]);
k = PrintList(&buf[32], (long)n, CARD32, "pixels");
- (void)PrintList(&buf[32 + k], (long)m, CARD32, "masks");
+ PrintList(&buf[32 + k], (long)m, CARD32, "masks");
}
+void
AllocColorPlanes(buf)
unsigned char *buf;
{
@@ -3030,6 +3207,7 @@ AllocColorPlanes(buf)
PrintField(buf, 14, 2, CARD16, "blues");
}
+void
AllocColorPlanesReply(buf)
unsigned char *buf;
{
@@ -3044,9 +3222,10 @@ AllocColorPlanesReply(buf)
PrintField(buf, 12, 4, CARD32, "red-mask");
PrintField(buf, 16, 4, CARD32, "green-mask");
PrintField(buf, 20, 4, CARD32, "blue-mask");
- (void)PrintList(&buf[32], (long)n, CARD32, "pixels");
+ PrintList(&buf[32], (long)n, CARD32, "pixels");
}
+void
FreeColors(buf)
unsigned char *buf;
{
@@ -3063,9 +3242,10 @@ FreeColors(buf)
n = IShort(&buf[2]) - 3;
PrintField(buf, 4, 4, COLORMAP, "cmap");
PrintField(buf, 8, 4, CARD32, "plane-mask");
- (void)PrintList(&buf[12], (long)n, CARD32, "pixels");
+ PrintList(&buf[12], (long)n, CARD32, "pixels");
}
+void
StoreColors(buf)
unsigned char *buf;
{
@@ -3080,9 +3260,10 @@ StoreColors(buf)
printfield(buf, 2, 2, DVALUE2(2 + 3*n), "request length");
n = (IShort(&buf[2]) - 2) / 3;
PrintField(buf, 4, 4, COLORMAP, "cmap");
- (void)PrintList(&buf[8], (long)n, COLORITEM, "items");
+ PrintList(&buf[8], (long)n, COLORITEM, "items");
}
+void
StoreNamedColor(buf)
unsigned char *buf;
{
@@ -3100,9 +3281,10 @@ StoreNamedColor(buf)
PrintField(buf, 8, 4, CARD32, "pixel");
printfield(buf, 12, 2, DVALUE2(n), "length of name");
n = IShort(&buf[12]);
- PrintString8(&buf[16], (long)n, "name");
+ PrintString8(&buf[16], n, "name");
}
+void
QueryColors(buf)
unsigned char *buf;
{
@@ -3117,9 +3299,10 @@ QueryColors(buf)
printfield(buf, 2, 2, DVALUE2(2 + n), "request length");
n = IShort(&buf[2]) - 2;
PrintField(buf, 4, 4, COLORMAP, "cmap");
- (void)PrintList(&buf[8], (long)n, CARD32, "pixels");
+ PrintList(&buf[8], (long)n, CARD32, "pixels");
}
+void
QueryColorsReply(buf)
unsigned char *buf;
{
@@ -3131,9 +3314,10 @@ QueryColorsReply(buf)
printfield(buf, 4, 4, DVALUE4(2*n), "reply length");
printfield(buf, 8, 2, DVALUE2(n), "number of colors");
n = IShort(&buf[8]);
- (void)PrintList(&buf[32], (long)n, RGB, "colors");
+ PrintList(&buf[32], (long)n, RGB, "colors");
}
+void
LookupColor(buf)
unsigned char *buf;
{
@@ -3149,9 +3333,10 @@ LookupColor(buf)
PrintField(buf, 4, 4, COLORMAP, "cmap");
printfield(buf, 8, 2, DVALUE2(n), "length of name");
n = IShort(&buf[8]);
- PrintString8(&buf[12], (long)n, "name");
+ PrintString8(&buf[12], n, "name");
}
+void
LookupColorReply(buf)
unsigned char *buf;
{
@@ -3168,6 +3353,7 @@ LookupColorReply(buf)
PrintField(buf, 18, 2, CARD16, "visual-blue");
}
+void
CreateCursor(buf)
unsigned char *buf;
{
@@ -3192,6 +3378,7 @@ CreateCursor(buf)
PrintField(buf, 30, 2, CARD16, "y");
}
+void
CreateGlyphCursor(buf)
unsigned char *buf;
{
@@ -3216,6 +3403,7 @@ CreateGlyphCursor(buf)
PrintField(buf, 30, 2, CARD16, "back-blue");
}
+void
FreeCursor(buf)
unsigned char *buf;
{
@@ -3230,6 +3418,7 @@ FreeCursor(buf)
PrintField(buf, 4, 4, CURSOR, "cursor");
}
+void
RecolorCursor(buf)
unsigned char *buf;
{
@@ -3250,6 +3439,7 @@ RecolorCursor(buf)
PrintField(buf, 18, 2, CARD16, "back-blue");
}
+void
QueryBestSize(buf)
unsigned char *buf;
{
@@ -3267,6 +3457,7 @@ QueryBestSize(buf)
PrintField(buf, 10, 2, CARD16, "height");
}
+void
QueryBestSizeReply(buf)
unsigned char *buf;
{
@@ -3279,6 +3470,7 @@ QueryBestSizeReply(buf)
PrintField(buf, 10, 2, CARD16, "height");
}
+void
QueryExtension(buf)
unsigned char *buf;
{
@@ -3294,9 +3486,9 @@ QueryExtension(buf)
printfield(buf, 4, 2, DVALUE2(n), "length of name");
n = IShort(&buf[4]);
PrintString8(&buf[8], (long)n, "name");
-
}
+void
QueryExtensionReply(buf)
unsigned char *buf;
{
@@ -3344,10 +3536,9 @@ QueryExtensionReply(buf)
PrintField(buf, 9, 1, CARD8, "major-opcode");
PrintField(buf, 10, 1, CARD8, "first-event");
PrintField(buf, 11, 1, CARD8, "first-error");
-
-
}
+void
ListExtensions(buf)
unsigned char *buf;
{
@@ -3361,6 +3552,7 @@ ListExtensions(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
ListExtensionsReply(buf)
unsigned char *buf;
{
@@ -3376,6 +3568,7 @@ ListExtensionsReply(buf)
PrintListSTR(&buf[32], (long)n, "names");
}
+void
ChangeKeyboardMapping(buf)
unsigned char *buf;
{
@@ -3394,9 +3587,10 @@ ChangeKeyboardMapping(buf)
PrintField(buf, 4, 1, KEYCODE, "first-keycode");
PrintField(buf, 5, 1, DVALUE1(m), "keysyms-per-keycode");
m = IByte(&buf[5]);
- (void)PrintList(&buf[8], (long)(n * m), KEYSYM, "keysyms");
+ PrintList(&buf[8], (long)(n * m), KEYSYM, "keysyms");
}
+void
GetKeyboardMapping(buf)
unsigned char *buf;
{
@@ -3412,6 +3606,7 @@ GetKeyboardMapping(buf)
PrintField(buf, 5, 1, CARD8, "count");
}
+void
GetKeyboardMappingReply(buf)
unsigned char *buf;
{
@@ -3423,9 +3618,10 @@ GetKeyboardMappingReply(buf)
printfield(buf, 2, 2, CARD16, "sequence number");
printfield(buf, 4, 4, DVALUE4(n*m), "reply length");
n = ILong(&buf[4]);
- (void)PrintList(&buf[32], n, KEYSYM, "keysyms");
+ PrintList(&buf[32], n, KEYSYM, "keysyms");
}
+void
ChangeKeyboardControl(buf)
unsigned char *buf;
{
@@ -3441,6 +3637,7 @@ ChangeKeyboardControl(buf)
PrintValues(&buf[4], 4, KEYBOARD_BITMASK, &buf[8], "value-list");
}
+void
GetKeyboardControl(buf)
unsigned char *buf;
{
@@ -3454,6 +3651,7 @@ GetKeyboardControl(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
GetKeyboardControlReply(buf)
unsigned char *buf;
{
@@ -3471,6 +3669,7 @@ GetKeyboardControlReply(buf)
PrintBytes(&buf[20], 32L, "auto-repeats");
}
+void
Bell(buf)
unsigned char *buf;
{
@@ -3485,6 +3684,7 @@ Bell(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
ChangePointerControl(buf)
unsigned char *buf;
{
@@ -3503,6 +3703,7 @@ ChangePointerControl(buf)
PrintField(buf, 11, 1, BOOL, "do-threshold");
}
+void
GetPointerControl(buf)
unsigned char *buf;
{
@@ -3516,6 +3717,7 @@ GetPointerControl(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
GetPointerControlReply(buf)
unsigned char *buf;
{
@@ -3529,6 +3731,7 @@ GetPointerControlReply(buf)
PrintField(buf, 12, 2, CARD16, "threshold");
}
+void
SetScreenSaver(buf)
unsigned char *buf;
{
@@ -3546,6 +3749,7 @@ SetScreenSaver(buf)
PrintField(buf, 9, 1, NO_YES, "allow-exposures");
}
+void
GetScreenSaver(buf)
unsigned char *buf;
{
@@ -3559,6 +3763,7 @@ GetScreenSaver(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
GetScreenSaverReply(buf)
unsigned char *buf;
{
@@ -3573,6 +3778,7 @@ GetScreenSaverReply(buf)
PrintField(buf, 13, 1, NO_YES, "allow-exposures");
}
+void
ChangeHosts(buf)
unsigned char *buf;
{
@@ -3586,12 +3792,17 @@ ChangeHosts(buf)
PrintField(buf, 1, 1, INS_DEL, "mode");
printfield(buf, 2, 2, DVALUE2(2 + (n + p) / 4), "request length");
+ n = IShort(&buf[6]);
+#if 0
PrintField(buf, 4, 1, HOSTFAMILY, "family");
printfield(buf, 6, 2, CARD16, "length of address");
- n = IShort(&buf[6]);
PrintBytes(&buf[8], (long)n, "address");
+#else
+ PrintField(buf, 4, 4+n, HOST, "host");
+#endif
}
+void
ListHosts(buf)
unsigned char *buf;
{
@@ -3605,6 +3816,7 @@ ListHosts(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
ListHostsReply(buf)
unsigned char *buf;
{
@@ -3617,9 +3829,10 @@ ListHostsReply(buf)
printfield(buf, 4, 4, DVALUE4(n / 4), "reply length");
printfield(buf, 8, 2, CARD16, "number of hosts");
n = IShort(&buf[8]);
- (void)PrintList(&buf[32], (long)n, HOST, "hosts");
+ PrintList(&buf[32], (long)n, HOST, "hosts");
}
+void
SetAccessControl(buf)
unsigned char *buf;
{
@@ -3634,6 +3847,7 @@ SetAccessControl(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
SetCloseDownMode(buf)
unsigned char *buf;
{
@@ -3648,6 +3862,7 @@ SetCloseDownMode(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
KillClient(buf)
unsigned char *buf;
{
@@ -3662,6 +3877,7 @@ KillClient(buf)
PrintField(buf, 4, 4, RESOURCEID, "resource");
}
+void
RotateProperties(buf)
unsigned char *buf;
{
@@ -3678,9 +3894,10 @@ RotateProperties(buf)
printfield(buf, 8, 2, DVALUE2(n), "number of properties");
n = IShort(&buf[8]);
PrintField(buf, 10, 2, INT16, "delta");
- (void)PrintList(&buf[12], (long)n, ATOM, "properties");
+ PrintList(&buf[12], (long)n, ATOM, "properties");
}
+void
ForceScreenSaver(buf)
unsigned char *buf;
{
@@ -3695,6 +3912,7 @@ ForceScreenSaver(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
SetPointerMapping(buf)
unsigned char *buf;
{
@@ -3712,6 +3930,7 @@ SetPointerMapping(buf)
PrintBytes(&buf[4], (long)n,"map");
}
+void
SetPointerMappingReply(buf)
unsigned char *buf;
{
@@ -3723,6 +3942,7 @@ SetPointerMappingReply(buf)
printfield(buf, 4, 4, CONST4(0), "reply length");
}
+void
GetPointerMapping(buf)
unsigned char *buf;
{
@@ -3736,6 +3956,7 @@ GetPointerMapping(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
GetPointerMappingReply(buf)
unsigned char *buf;
{
@@ -3750,6 +3971,7 @@ GetPointerMappingReply(buf)
PrintBytes(&buf[32], (long)n,"map");
}
+void
SetModifierMapping(buf)
unsigned char *buf;
{
@@ -3774,6 +3996,7 @@ SetModifierMapping(buf)
PrintBytes(&buf[4 + 7 * n], (long)n,"Mod5 keycodes");
}
+void
SetModifierMappingReply(buf)
unsigned char *buf;
{
@@ -3785,6 +4008,7 @@ SetModifierMappingReply(buf)
printfield(buf, 4, 4, CONST4(0), "reply length");
}
+void
GetModifierMapping(buf)
unsigned char *buf;
{
@@ -3798,6 +4022,7 @@ GetModifierMapping(buf)
printfield(buf, 2, 2, CONST2(1), "request length");
}
+void
GetModifierMappingReply(buf)
unsigned char *buf;
{
@@ -3809,9 +4034,10 @@ GetModifierMappingReply(buf)
n = IByte(&buf[1]);
printfield(buf, 2, 2, CARD16, "sequence number");
printfield(buf, 4, 4, DVALUE4(2*n), "reply length");
- (void)PrintList(&buf[32], (long)n, KEYCODE, "keycodes");
+ PrintList(&buf[32], (long)n, KEYCODE, "keycodes");
}
+void
NoOperation(buf)
unsigned char *buf;
{
diff --git a/proto.h b/proto.h
new file mode 100644
index 0000000..c8f06d3
--- /dev/null
+++ b/proto.h
@@ -0,0 +1,271 @@
+#include "x11.h"
+
+/* common.c */
+void enterprocedure(char *s);
+void warn(char *s);
+void panic(char *s);
+void *Malloc(long n);
+void Free(void *p);
+void SetSignalHandling(void);
+void SetUpConnectionSocket(int iport, int (*connectionFunc)());
+/* decode11.c */
+void InitReplyQ(void);
+void FlushReplyQ(FD fd);
+void KeepLastReplyExpected(void);
+void DecodeRequest(FD fd, unsigned char *buf, long n);
+void DecodeReply(FD fd, unsigned char *buf, long n);
+void DecodeError(FD fd, unsigned char *buf, long n);
+void DecodeEvent(FD fd, unsigned char *buf, long n);
+/* print11.c */
+void PrintSetUpMessage(unsigned char *buf);
+void PrintSetUpReply(unsigned char *buf);
+void RequestError(unsigned char *buf);
+void ValueError(unsigned char *buf);
+void WindowError(unsigned char *buf);
+void PixmapError(unsigned char *buf);
+void AtomError(unsigned char *buf);
+void CursorError(unsigned char *buf);
+void FontError(unsigned char *buf);
+void MatchError(unsigned char *buf);
+void DrawableError(unsigned char *buf);
+void AccessError(unsigned char *buf);
+void AllocError(unsigned char *buf);
+void ColormapError(unsigned char *buf);
+void GContextError(unsigned char *buf);
+void IDChoiceError(unsigned char *buf);
+void NameError(unsigned char *buf);
+void LengthError(unsigned char *buf);
+void ImplementationError(unsigned char *buf);
+void KeyPressEvent(unsigned char *buf);
+void KeyReleaseEvent(unsigned char *buf);
+void ButtonPressEvent(unsigned char *buf);
+void ButtonReleaseEvent(unsigned char *buf);
+void MotionNotifyEvent(unsigned char *buf);
+void EnterNotifyEvent(unsigned char *buf);
+void LeaveNotifyEvent(unsigned char *buf);
+void FocusInEvent(unsigned char *buf);
+void FocusOutEvent(unsigned char *buf);
+void KeymapNotifyEvent(unsigned char *buf);
+void ExposeEvent(unsigned char *buf);
+void GraphicsExposureEvent(unsigned char *buf);
+void NoExposureEvent(unsigned char *buf);
+void VisibilityNotifyEvent(unsigned char *buf);
+void CreateNotifyEvent(unsigned char *buf);
+void DestroyNotifyEvent(unsigned char *buf);
+void UnmapNotifyEvent(unsigned char *buf);
+void MapNotifyEvent(unsigned char *buf);
+void MapRequestEvent(unsigned char *buf);
+void ReparentNotifyEvent(unsigned char *buf);
+void ConfigureNotifyEvent(unsigned char *buf);
+void ConfigureRequestEvent(unsigned char *buf);
+void GravityNotifyEvent(unsigned char *buf);
+void ResizeRequestEvent(unsigned char *buf);
+void CirculateNotifyEvent(unsigned char *buf);
+void CirculateRequestEvent(unsigned char *buf);
+void PropertyNotifyEvent(unsigned char *buf);
+void SelectionClearEvent(unsigned char *buf);
+void SelectionRequestEvent(unsigned char *buf);
+void SelectionNotifyEvent(unsigned char *buf);
+void ColormapNotifyEvent(unsigned char *buf);
+void ClientMessageEvent(unsigned char *buf);
+void MappingNotifyEvent(unsigned char *buf);
+void CreateWindow(unsigned char *buf);
+void ChangeWindowAttributes(unsigned char *buf);
+void GetWindowAttributes(unsigned char *buf);
+void GetWindowAttributesReply(unsigned char *buf);
+void DestroyWindow(unsigned char *buf);
+void DestroySubwindows(unsigned char *buf);
+void ChangeSaveSet(unsigned char *buf);
+void ReparentWindow(unsigned char *buf);
+void MapWindow(unsigned char *buf);
+void MapSubwindows(unsigned char *buf);
+void UnmapWindow(unsigned char *buf);
+void UnmapSubwindows(unsigned char *buf);
+void ConfigureWindow(unsigned char *buf);
+void CirculateWindow(unsigned char *buf);
+void GetGeometry(unsigned char *buf);
+void GetGeometryReply(unsigned char *buf);
+void QueryTree(unsigned char *buf);
+void QueryTreeReply(unsigned char *buf);
+void InternAtom(unsigned char *buf);
+void InternAtomReply(unsigned char *buf);
+void GetAtomName(unsigned char *buf);
+void GetAtomNameReply(unsigned char *buf);
+void ChangeProperty(unsigned char *buf);
+void DeleteProperty(unsigned char *buf);
+void GetProperty(unsigned char *buf);
+void GetPropertyReply(unsigned char *buf);
+void ListProperties(unsigned char *buf);
+void ListPropertiesReply(unsigned char *buf);
+void SetSelectionOwner(unsigned char *buf);
+void GetSelectionOwner(unsigned char *buf);
+void GetSelectionOwnerReply(unsigned char *buf);
+void ConvertSelection(unsigned char *buf);
+void SendEvent(unsigned char *buf);
+void GrabPointer(unsigned char *buf);
+void GrabPointerReply(unsigned char *buf);
+void UngrabPointer(unsigned char *buf);
+void GrabButton(unsigned char *buf);
+void UngrabButton(unsigned char *buf);
+void ChangeActivePointerGrab(unsigned char *buf);
+void GrabKeyboard(unsigned char *buf);
+void GrabKeyboardReply(unsigned char *buf);
+void UngrabKeyboard(unsigned char *buf);
+void GrabKey(unsigned char *buf);
+void UngrabKey(unsigned char *buf);
+void AllowEvents(unsigned char *buf);
+void GrabServer(unsigned char *buf);
+void UngrabServer(unsigned char *buf);
+void QueryPointer(unsigned char *buf);
+void QueryPointerReply(unsigned char *buf);
+void GetMotionEvents(unsigned char *buf);
+void GetMotionEventsReply(unsigned char *buf);
+void TranslateCoordinates(unsigned char *buf);
+void TranslateCoordinatesReply(unsigned char *buf);
+void WarpPointer(unsigned char *buf);
+void SetInputFocus(unsigned char *buf);
+void GetInputFocus(unsigned char *buf);
+void GetInputFocusReply(unsigned char *buf);
+void QueryKeymap(unsigned char *buf);
+void QueryKeymapReply(unsigned char *buf);
+void OpenFont(unsigned char *buf);
+void CloseFont(unsigned char *buf);
+void QueryFont(unsigned char *buf);
+void QueryFontReply(unsigned char *buf);
+void QueryTextExtents(unsigned char *buf);
+void QueryTextExtentsReply(unsigned char *buf);
+void ListFonts(unsigned char *buf);
+void ListFontsReply(unsigned char *buf);
+void ListFontsWithInfo(unsigned char *buf);
+void ListFontsWithInfoReply(unsigned char *buf);
+void SetFontPath(unsigned char *buf);
+void GetFontPath(unsigned char *buf);
+void GetFontPathReply(unsigned char *buf);
+void CreatePixmap(unsigned char *buf);
+void FreePixmap(unsigned char *buf);
+void CreateGC(unsigned char *buf);
+void ChangeGC(unsigned char *buf);
+void CopyGC(unsigned char *buf);
+void SetDashes(unsigned char *buf);
+void SetClipRectangles(unsigned char *buf);
+void FreeGC(unsigned char *buf);
+void ClearArea(unsigned char *buf);
+void CopyArea(unsigned char *buf);
+void CopyPlane(unsigned char *buf);
+void PolyPoint(unsigned char *buf);
+void PolyLine(unsigned char *buf);
+void PolySegment(unsigned char *buf);
+void PolyRectangle(unsigned char *buf);
+void PolyArc(unsigned char *buf);
+void FillPoly(unsigned char *buf);
+void PolyFillRectangle(unsigned char *buf);
+void PolyFillArc(unsigned char *buf);
+void PutImage(unsigned char *buf);
+void GetImage(unsigned char *buf);
+void GetImageReply(unsigned char *buf);
+void PolyText8(unsigned char *buf);
+void PolyText16(unsigned char *buf);
+void ImageText8(unsigned char *buf);
+void ImageText16(unsigned char *buf);
+void CreateColormap(unsigned char *buf);
+void FreeColormap(unsigned char *buf);
+void CopyColormapAndFree(unsigned char *buf);
+void InstallColormap(unsigned char *buf);
+void UninstallColormap(unsigned char *buf);
+void ListInstalledColormaps(unsigned char *buf);
+void ListInstalledColormapsReply(unsigned char *buf);
+void AllocColor(unsigned char *buf);
+void AllocColorReply(unsigned char *buf);
+void AllocNamedColor(unsigned char *buf);
+void AllocNamedColorReply(unsigned char *buf);
+void AllocColorCells(unsigned char *buf);
+void AllocColorCellsReply(unsigned char *buf);
+void AllocColorPlanes(unsigned char *buf);
+void AllocColorPlanesReply(unsigned char *buf);
+void FreeColors(unsigned char *buf);
+void StoreColors(unsigned char *buf);
+void StoreNamedColor(unsigned char *buf);
+void QueryColors(unsigned char *buf);
+void QueryColorsReply(unsigned char *buf);
+void LookupColor(unsigned char *buf);
+void LookupColorReply(unsigned char *buf);
+void CreateCursor(unsigned char *buf);
+void CreateGlyphCursor(unsigned char *buf);
+void FreeCursor(unsigned char *buf);
+void RecolorCursor(unsigned char *buf);
+void QueryBestSize(unsigned char *buf);
+void QueryBestSizeReply(unsigned char *buf);
+void QueryExtension(unsigned char *buf);
+void QueryExtensionReply(unsigned char *buf);
+void ListExtensions(unsigned char *buf);
+void ListExtensionsReply(unsigned char *buf);
+void ChangeKeyboardMapping(unsigned char *buf);
+void GetKeyboardMapping(unsigned char *buf);
+void GetKeyboardMappingReply(unsigned char *buf);
+void ChangeKeyboardControl(unsigned char *buf);
+void GetKeyboardControl(unsigned char *buf);
+void GetKeyboardControlReply(unsigned char *buf);
+void Bell(unsigned char *buf);
+void ChangePointerControl(unsigned char *buf);
+void GetPointerControl(unsigned char *buf);
+void GetPointerControlReply(unsigned char *buf);
+void SetScreenSaver(unsigned char *buf);
+void GetScreenSaver(unsigned char *buf);
+void GetScreenSaverReply(unsigned char *buf);
+void ChangeHosts(unsigned char *buf);
+void ListHosts(unsigned char *buf);
+void ListHostsReply(unsigned char *buf);
+void SetAccessControl(unsigned char *buf);
+void SetCloseDownMode(unsigned char *buf);
+void KillClient(unsigned char *buf);
+void RotateProperties(unsigned char *buf);
+void ForceScreenSaver(unsigned char *buf);
+void SetPointerMapping(unsigned char *buf);
+void SetPointerMappingReply(unsigned char *buf);
+void GetPointerMapping(unsigned char *buf);
+void GetPointerMappingReply(unsigned char *buf);
+void SetModifierMapping(unsigned char *buf);
+void SetModifierMappingReply(unsigned char *buf);
+void GetModifierMapping(unsigned char *buf);
+void GetModifierMappingReply(unsigned char *buf);
+void NoOperation(unsigned char *buf);
+/* prtype.c */
+void SetIndentLevel(int which);
+void DumpHexBuffer(unsigned char *buf, long n);
+void DumpItem(char *name, FD fd, unsigned char *buf, long n);
+void PrintField(unsigned char *buf, int start, int length, int FieldType, char *name);
+long PrintList(unsigned char *buf, long number, int ListType, char *name);
+long PrintListSTR(unsigned char *buf, long number, char *name);
+int PrintBytes(unsigned char buf[], long number, char *name);
+int PrintString8(unsigned char buf[], int number, char *name);
+int PrintString16(unsigned char buf[], int number, char *name);
+void PrintValues(unsigned char *control, int clength, int ctype, unsigned char *values, char *name);
+int PrintTextList8(unsigned char *buf, int length, char *name);
+int PrintTextList16(unsigned char *buf, int length, char *name);
+/* scope.c */
+void TimerExpired(void);
+FD FDPair(FD fd);
+FD ClientHalf(FD fd);
+FD ServerHalf(FD fd);
+char *ClientName(FD fd);
+void NewConnection(FD fd);
+/* server.c */
+FD ConnectToServer(int report);
+void ProcessBuffer(FD fd, unsigned char *buf, long n);
+void ReportFromClient(FD fd, unsigned char *buf, long n);
+void ReportFromServer(FD fd, unsigned char *buf, long n);
+void PrintTime(void);
+long pad(long n);
+unsigned long ILong(unsigned char buf[]);
+unsigned short IShort(unsigned char buf[]);
+unsigned short IByte(unsigned char buf[]);
+short IBool(unsigned char buf[]);
+void StartClientConnection(FD fd);
+void StopClientConnection(FD fd);
+void StartServerConnection(FD fd);
+void StopServerConnection(FD fd);
+long StartSetUpMessage(FD fd, unsigned char *buf, long n);
+long StartSetUpReply(FD fd, unsigned char *buf, long n);
+/* table11.c */
+void InitializeX11(void);
+
diff --git a/prtype.c b/prtype.c
index 7b6064e..53acb25 100644
--- a/prtype.c
+++ b/prtype.c
@@ -23,6 +23,33 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* *
+ * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
* ************************************************** */
#include "scope.h"
@@ -49,7 +76,7 @@ extern int littleEndian;
/* print representation of a character for debugging */
-char *printrep (c)
+static char *printrep (c)
unsigned short c;
{
static char pr[8];
@@ -64,7 +91,7 @@ char *printrep (c)
else if (c < 127)
{
/* printing characters */
- pr[0] = c;
+ pr[0] = (char) c;
pr[1] = '\0';
}
else if (c == 127)
@@ -83,7 +110,7 @@ char *printrep (c)
else
{
/* very large number -- print as 0xffff - 4 digit hex */
- (void)sprintf(pr, "0x%04x", c);
+ sprintf(pr, "0x%04x", c);
}
return(pr);
}
@@ -108,6 +135,7 @@ char *printrep (c)
char Leader[MaxIndent + 1];
static short CurrentLevel = 0;
+void
SetIndentLevel(which)
short which;
{
@@ -128,13 +156,14 @@ SetIndentLevel(which)
CurrentLevel = which;
}
+static void
ModifyIndentLevel(amount)
short amount;
{
SetIndentLevel(CurrentLevel + amount);
}
-short SizeofLeader ()
+static short SizeofLeader ()
{
return (CurrentLevel * 8);
}
@@ -146,6 +175,7 @@ short SizeofLeader ()
/* if we want verbose enough output, we will dump the buffer in hex */
+void
DumpItem(name, fd, buf, n)
char *name;
FD fd;
@@ -166,8 +196,8 @@ DumpItem(name, fd, buf, n)
/* */
/* ************************************************************ */
-PrintINT8(buf)
- unsigned char *buf;
+int
+PrintINT8(unsigned char *buf)
{
/* print a INT8 -- 8-bit signed integer */
short n = IByte (buf);
@@ -177,8 +207,8 @@ PrintINT8(buf)
return 1;
}
-PrintINT16(buf)
- unsigned char *buf;
+int
+PrintINT16(unsigned char *buf)
{
/* print a INT16 -- 16-bit signed integer */
long n = IShort (buf);
@@ -188,8 +218,8 @@ PrintINT16(buf)
return 2;
}
-PrintINT32(buf)
- unsigned char *buf;
+int
+PrintINT32(unsigned char *buf)
{
/* print a INT32 -- 32-bit signed integer */
long n = ILong (buf);
@@ -199,17 +229,17 @@ PrintINT32(buf)
/* ************************************************************ */
-PrintCARD8(buf)
- unsigned char *buf;
+int
+PrintCARD8(unsigned char *buf)
{
/* print a CARD8 -- 8-bit unsigned integer */
- short n = IByte (buf);
+ unsigned short n = IByte (buf);
fprintf(stdout, "%02x", (unsigned)(n & 0xff));
return 1;
}
-PrintCARD16(buf)
- unsigned char *buf;
+int
+PrintCARD16(unsigned char *buf)
{
/* print a CARD16 -- 16-bit unsigned integer */
unsigned long n = IShort (buf);
@@ -217,8 +247,8 @@ PrintCARD16(buf)
return 1;
}
-PrintCARD32(buf)
- unsigned char *buf;
+int
+PrintCARD32(unsigned char *buf)
{
/* print a CARD32 -- 32-bit unsigned integer */
unsigned long n = ILong (buf);
@@ -228,8 +258,8 @@ PrintCARD32(buf)
/* ************************************************************ */
-PrintBYTE(buf)
- unsigned char *buf;
+int
+PrintBYTE(unsigned char *buf)
{
/* print a BYTE -- 8-bit value */
short n = IByte (buf);
@@ -238,8 +268,8 @@ PrintBYTE(buf)
}
-PrintCHAR8(buf)
- unsigned char *buf;
+int
+PrintCHAR8(unsigned char *buf)
{
/* print a CHAR8 -- 8-bit character */
unsigned short n = IByte (buf);
@@ -248,8 +278,8 @@ PrintCHAR8(buf)
}
-PrintSTRING16(buf)
- unsigned char *buf;
+int
+PrintSTRING16(unsigned char *buf)
{
/* print a CHAR2B -- 16-bit character which is never byte-swapped */
unsigned short n = IChar2B (buf);
@@ -257,8 +287,8 @@ PrintSTRING16(buf)
return 2 + n;
}
-PrintSTR(buf)
- unsigned char *buf;
+int
+PrintSTR(unsigned char *buf)
{
/* STR have the length (1 byte) then a string of CHAR8 */
short n;
@@ -272,8 +302,8 @@ PrintSTR(buf)
/* ************************************************************ */
-PrintWINDOW(buf)
- unsigned char *buf;
+int
+PrintWINDOW(unsigned char *buf)
{
/* print a WINDOW -- CARD32 plus 0 = None */
long n = ILong (buf);
@@ -284,8 +314,8 @@ PrintWINDOW(buf)
return(4);
}
-PrintWINDOWD(buf)
- unsigned char *buf;
+int
+PrintWINDOWD(unsigned char *buf)
{
/* print a WINDOWD -- CARD32 plus 0 = PointerWindow, 1 = InputFocus */
long n = ILong (buf);
@@ -298,8 +328,8 @@ PrintWINDOWD(buf)
return 4;
}
-PrintWINDOWNR(buf)
- unsigned char *buf;
+int
+PrintWINDOWNR(unsigned char *buf)
{
/* print a WINDOWNR -- CARD32 plus 0 = None, 1 = PointerRoot */
long n = ILong (buf);
@@ -313,8 +343,8 @@ PrintWINDOWNR(buf)
}
-PrintPIXMAP(buf)
- unsigned char *buf;
+int
+PrintPIXMAP(unsigned char *buf)
{
/* print a PIXMAP -- CARD32 plus 0 = None */
long n = ILong (buf);
@@ -325,8 +355,8 @@ PrintPIXMAP(buf)
return 4;
}
-PrintPIXMAPNPR(buf)
- unsigned char *buf;
+int
+PrintPIXMAPNPR(unsigned char *buf)
{
/* print a PIXMAPNPR -- CARD32 plus 0 = None, 1 = ParentRelative */
long n = ILong (buf);
@@ -339,8 +369,8 @@ PrintPIXMAPNPR(buf)
return 4;
}
-PrintPIXMAPC(buf)
- unsigned char *buf;
+int
+PrintPIXMAPC(unsigned char *buf)
{
/* print a PIXMAPC -- CARD32 plus 0 = CopyFromParent */
long n = ILong (buf);
@@ -352,8 +382,8 @@ PrintPIXMAPC(buf)
}
-PrintCURSOR(buf)
- unsigned char *buf;
+int
+PrintCURSOR(unsigned char *buf)
{
/* print a CURSOR -- CARD32 plus 0 = None */
long n = ILong (buf);
@@ -365,8 +395,8 @@ PrintCURSOR(buf)
}
-PrintFONT(buf)
- unsigned char *buf;
+int
+PrintFONT(unsigned char *buf)
{
/* print a FONT -- CARD32 plus 0 = None */
long n = ILong (buf);
@@ -378,8 +408,8 @@ PrintFONT(buf)
}
-PrintGCONTEXT(buf)
- unsigned char *buf;
+int
+PrintGCONTEXT(unsigned char *buf)
{
/* print a GCONTEXT -- CARD32 */
long n = ILong (buf);
@@ -388,8 +418,8 @@ PrintGCONTEXT(buf)
}
-PrintCOLORMAP(buf)
- unsigned char *buf;
+int
+PrintCOLORMAP(unsigned char *buf)
{
/* print a COLORMAP -- CARD32 plus 0 = None */
long n = ILong (buf);
@@ -400,8 +430,8 @@ PrintCOLORMAP(buf)
return(4);
}
-PrintCOLORMAPC(buf)
- unsigned char *buf;
+int
+PrintCOLORMAPC(unsigned char *buf)
{
/* print a COLORMAPC -- CARD32 plus 0 = CopyFromParent */
long n = ILong (buf);
@@ -413,8 +443,8 @@ PrintCOLORMAPC(buf)
}
-PrintDRAWABLE(buf)
- unsigned char *buf;
+int
+PrintDRAWABLE(unsigned char *buf)
{
/* print a DRAWABLE -- CARD32 */
long n = ILong (buf);
@@ -422,8 +452,8 @@ PrintDRAWABLE(buf)
return 4;
}
-PrintFONTABLE(buf)
- unsigned char *buf;
+int
+PrintFONTABLE(unsigned char *buf)
{
/* print a FONTABLE -- CARD32 */
long n = ILong (buf);
@@ -435,7 +465,7 @@ PrintFONTABLE(buf)
#define NumberofAtoms 68
-char *AtomTable[NumberofAtoms + 1] =
+static char *AtomTable[NumberofAtoms + 1] =
{
"NONE", "PRIMARY", "SECONDARY", "ARC", "ATOM", "BITMAP", "CARDINAL",
"COLORMAP", "CURSOR", "CUT_BUFFER0", "CUT_BUFFER1", "CUT_BUFFER2",
@@ -457,8 +487,8 @@ char *AtomTable[NumberofAtoms + 1] =
/* for atoms, we print the built-in atoms. We could expand to printing
the user defined ones, too. */
-PrintATOM(buf)
- unsigned char *buf;
+int
+PrintATOM(unsigned char *buf)
{
/* print a ATOM -- CARD32 plus 0 = None */
long n = ILong (buf);
@@ -469,8 +499,8 @@ PrintATOM(buf)
return(4);
}
-PrintATOMT(buf)
- unsigned char *buf;
+int
+PrintATOMT(unsigned char *buf)
{
/* print a ATOMT -- CARD32 plus 0 = AnyPropertyType */
long n = ILong (buf);
@@ -482,8 +512,8 @@ PrintATOMT(buf)
}
-PrintVISUALID(buf)
- unsigned char *buf;
+int
+PrintVISUALID(unsigned char *buf)
{
/* print a VISUALID -- CARD32 plus 0 = None */
long n = ILong (buf);
@@ -494,8 +524,8 @@ PrintVISUALID(buf)
return 4;
}
-PrintVISUALIDC(buf)
- unsigned char *buf;
+int
+PrintVISUALIDC(unsigned char *buf)
{
/* print a VISUALIDC -- CARD32 plus 0 = CopyFromParent */
long n = ILong (buf);
@@ -507,8 +537,8 @@ PrintVISUALIDC(buf)
}
-PrintTIMESTAMP(buf)
- unsigned char *buf;
+int
+PrintTIMESTAMP(unsigned char *buf)
{
/* print a TIMESTAMP -- CARD32 plus 0 as the current time */
long n = ILong (buf);
@@ -520,8 +550,8 @@ PrintTIMESTAMP(buf)
}
-PrintRESOURCEID(buf)
- unsigned char *buf;
+int
+PrintRESOURCEID(unsigned char *buf)
{
/* print a RESOURCEID -- CARD32 plus 0 = AllTemporary */
long n = ILong (buf);
@@ -533,8 +563,8 @@ PrintRESOURCEID(buf)
}
-PrintKEYSYM(buf)
- unsigned char *buf;
+int
+PrintKEYSYM(unsigned char *buf)
{
/* print a KEYSYM -- CARD32 */
long n = ILong (buf);
@@ -542,8 +572,8 @@ PrintKEYSYM(buf)
return(4);
}
-PrintKEYCODE(buf)
- unsigned char *buf;
+int
+PrintKEYCODE(unsigned char *buf)
{
/* print a KEYCODE -- CARD8 */
unsigned short n = IByte (buf);
@@ -551,8 +581,8 @@ PrintKEYCODE(buf)
return(1);
}
-PrintKEYCODEA(buf)
- unsigned char *buf;
+int
+PrintKEYCODEA(unsigned char *buf)
{
/* print a KEYCODEA -- CARD8 plus 0 = AnyKey */
long n = IByte (buf);
@@ -564,8 +594,8 @@ PrintKEYCODEA(buf)
}
-PrintBUTTON(buf)
- unsigned char *buf;
+int
+PrintBUTTON(unsigned char *buf)
{
/* print a BUTTON -- CARD8 */
unsigned short n = IByte (buf);
@@ -573,8 +603,8 @@ PrintBUTTON(buf)
return 1;
}
-PrintBUTTONA(buf)
- unsigned char *buf;
+int
+PrintBUTTONA(unsigned char *buf)
{
/* print a BUTTONA -- CARD8 plus 0 = AnyButton */
long n = IByte (buf);
@@ -588,8 +618,8 @@ PrintBUTTONA(buf)
/* this is an interesting cheat -- we call DecodeEvent to print an event */
/* should work, but its never been tried */
-PrintEVENTFORM(buf)
- unsigned char *buf;
+int
+PrintEVENTFORM(unsigned char *buf)
{
/* print an EVENT_FORM -- event format */
DecodeEvent(-1, buf, (long)-1);
@@ -598,10 +628,11 @@ PrintEVENTFORM(buf)
/* ************************************************************ */
-PrintENUMERATED(buf, length, ValueList)
- unsigned char *buf;
- short length;
- struct ValueListEntry *ValueList;
+int
+PrintENUMERATED(
+ unsigned char *buf,
+ short length,
+ struct ValueListEntry *ValueList)
{
long n;
struct ValueListEntry *p;
@@ -625,10 +656,11 @@ PrintENUMERATED(buf, length, ValueList)
/* ************************************************************ */
-PrintSET(buf, length, ValueList)
- unsigned char *buf;
- short length;
- struct ValueListEntry *ValueList;
+int
+PrintSET(
+ unsigned char *buf,
+ short length,
+ struct ValueListEntry *ValueList)
{
unsigned long n;
struct ValueListEntry *p;
@@ -678,6 +710,7 @@ PrintSET(buf, length, ValueList)
/* */
/* ************************************************************ */
+void
PrintField(buf, start, length, FieldType, name)
unsigned char *buf;
short start;
@@ -720,7 +753,7 @@ PrintField(buf, start, length, FieldType, name)
break;
}
fprintf(stdout, "\n");
- (void)fflush(stdout);
+ fflush(stdout);
}
/* ************************************************************ */
@@ -782,7 +815,7 @@ long PrintList(buf, number, ListType, name)
/* print a list of STRs. Similar to PrintList
They start at <buf>. There are <number> things in the list */
-PrintListSTR(buf, number, name)
+long PrintListSTR(buf, number, name)
unsigned char *buf;
long number;
char *name;
@@ -792,11 +825,11 @@ PrintListSTR(buf, number, name)
long sum;
if (number == 0)
- return;
+ return(0);
fprintf(stdout, "%s%20s: (%d)\n", Leader, name, number);
if (Verbose < 2)
- return;
+ return(0);
ModifyIndentLevel(1);
sum = 0;
@@ -810,7 +843,7 @@ PrintListSTR(buf, number, name)
}
ModifyIndentLevel(-1);
- return;
+ return(sum);
}
@@ -820,17 +853,18 @@ PrintListSTR(buf, number, name)
/* ************************************************************ */
-PrintBytes(buf, number, name)
- unsigned char buf[];
- long number;
- char *name;
+int
+PrintBytes(
+ unsigned char buf[],
+ long number,
+ char *name)
{
/* print a list of BYTE -- 8-bit character */
long i;
short column;
if (number == 0)
- return;
+ return(0);
fprintf(stdout, "%s%20s: ", Leader, name);
column = SizeofLeader() + 25;
@@ -848,7 +882,7 @@ PrintBytes(buf, number, name)
}
fprintf(stdout, "\n");
- return;
+ return(number);
}
@@ -860,35 +894,39 @@ PrintBytes(buf, number, name)
/* print a String of CHAR8 -- 8-bit characters */
-PrintString8(buf, number, name)
- unsigned char buf[];
- long number;
- char *name;
+int
+PrintString8(
+ unsigned char buf[],
+ int number,
+ char *name)
{
- long i;
+ short i;
if (number == 0)
- return;
+ return(0);
fprintf(stdout, "%s%20s: \"", Leader, name);
for (i = 0; i < number; i++)
fprintf(stdout, "%s", printrep(buf[i]));
fprintf(stdout, "\"\n");
+
+ return(number);
}
-/* print a String of CHAR2B -- 16-bit characters */
+/* print a String of CHAR16 -- 16-bit characters */
-PrintString16(buf, number, name)
- unsigned char buf[];
- long number;
- char *name;
+int
+PrintString16(
+ unsigned char buf[],
+ int number,
+ char *name)
{
long i;
unsigned short c;
if (number == 0)
- return;
+ return(0);
fprintf(stdout, "%s%20s: \"", Leader, name);
for (i = 0; i < number; i += 2)
@@ -897,6 +935,8 @@ PrintString16(buf, number, name)
fprintf(stdout, "%s", printrep(c));
}
fprintf(stdout, "\"\n");
+
+ return(number);
}
extern long TranslateText;
@@ -961,12 +1001,13 @@ PrintTString16(buf, number, name)
(2) A list of values.
*/
-PrintValues(control, clength, ctype, values, name)
- unsigned char *control;
- short clength;
- short ctype;
- unsigned char *values;
- char *name;
+void
+PrintValues(
+ unsigned char *control,
+ int clength,
+ int ctype,
+ unsigned char *values,
+ char *name)
{
long cmask;
struct ValueListEntry *p;
@@ -1012,10 +1053,11 @@ PrintValues(control, clength, ctype, values, name)
/* PolyText8 and PolyText16 take lists of characters with possible
font changes in them. */
-PrintTextList8(buf, length, name)
- unsigned char *buf;
- short length;
- char *name;
+int
+PrintTextList8(
+ unsigned char *buf,
+ int length,
+ char *name)
{
short n;
@@ -1039,10 +1081,11 @@ PrintTextList8(buf, length, name)
}
}
-PrintTextList16(buf, length, name)
- unsigned char *buf;
- short length;
- char *name;
+int
+PrintTextList16(
+ unsigned char *buf,
+ int length,
+ char *name)
{
short n;
@@ -1074,9 +1117,10 @@ PrintTextList16(buf, length, name)
#define MAXline 78
-DumpHexBuffer(buf, n)
- unsigned char *buf;
- long n;
+void
+DumpHexBuffer(
+ unsigned char *buf,
+ long n)
{
long i;
short column;
@@ -1086,7 +1130,7 @@ DumpHexBuffer(buf, n)
for (i = 0; i < n; i++)
{
/* get the hex representations */
- (void)sprintf(h, "%02x",(0xff & buf[i]));
+ sprintf(h, "%02x",(0xff & buf[i]));
/* check if these characters will fit on this line */
if ((column + strlen(h) + 1) > MAXline)
diff --git a/scope-transport.c b/scope-transport.c
new file mode 100644
index 0000000..624d292
--- /dev/null
+++ b/scope-transport.c
@@ -0,0 +1,10 @@
+/* Xscope xtrans layer */
+
+#include "config.h"
+
+extern short debuglevel;
+#define DEBUG ((debuglevel & 4) ? 4 : 1)
+#define TRANS_CLIENT
+#define TRANS_SERVER
+#define X11_t
+#include <X11/Xtrans/transport.c>
diff --git a/scope.c b/scope.c
index 52eadee..96164b7 100644
--- a/scope.c
+++ b/scope.c
@@ -23,10 +23,46 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* *
+ * *
+ * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
***************************************************** */
#include "scope.h"
+#include <unistd.h>
+#include <sys/param.h>
+
+#ifdef SYSV
+#define bzero(s,l) memset(s, 0, l)
+#define bcopy(s,d,l) memmove(d,s,l)
+#endif
+
#include <sys/uio.h> /* for struct iovec, used by socket.h */
#include <sys/socket.h> /* for AF_INET, SOCK_STREAM, ... */
#include <sys/ioctl.h> /* for FIONCLEX, FIONBIO, ... */
@@ -40,6 +76,7 @@
#include <errno.h> /* for EINTR, EADDRINUSE, ... */
extern int errno;
+
extern InitializePEX();
/* ********************************************** */
/* */
@@ -47,12 +84,38 @@ extern InitializePEX();
#define DefaultPort 6000
-char ServerHostName[255];
-char AudioServerHostName[255];
-long ServerBasePort = DefaultPort;
-long ServerInPort = 1;
-long ServerOutPort = 0;
-long ServerDisplay = 0;
+ char ServerHostName[MAXHOSTNAMELEN];
+ char AudioServerHostName[MAXHOSTNAMELEN];
+ long ServerBasePort = DefaultPort;
+static long ServerInPort = 1;
+static long ServerOutPort = 0;
+static long ServerDisplay = 0;
+
+#ifdef USE_XTRANS
+#undef DNETCONN
+#undef DNETSVR4
+#endif
+
+#ifdef DNETCONN
+#include <X11/dni.h>
+#include <sys/fcntl.h>
+int decnet_in = 0;
+int decnet_out = 0;
+int decnet_server = 0;
+#endif
+#ifdef DNETSVR4
+#include <X11/dni8.h>
+extern struct hostent *(*dnet_gethostbyname)();
+extern int (*dnet_gethostname)();
+short initialize_libdni();
+int decnet_in = 0;
+int decnet_out = 0;
+int decnet_server = 0;
+#endif
+
+static FD ConnectToClient(FD ConnectionSocket);
+static void SetUpStdin(void);
+
long TranslateText = 0;
char ScopeEnabled = 1;
char HandleSIGUSR1 = 0;
@@ -381,7 +444,7 @@ setBreakPoint ()
BreakPoint = b;
for (fd = 0; fd < HighestFD; fd++)
{
- extern DataFromClient();
+ static void DataFromClient(FD fd);
if (FDD[fd].Busy && FDD[fd].InputHandler == DataFromClient)
{
@@ -606,23 +669,35 @@ CMDAudio (argc, argv)
/* */
/* ********************************************** */
-short GetServerport ()
+short GetServerport ()
{
short port;
enterprocedure("GetServerport");
+#if defined(DNETCONN) || defined(DNETSVR4)
+ if (decnet_server) {
+ port = ServerDisplay + ServerOutPort;
+ return(port);
+ }
+#endif
port = ServerBasePort + ServerOutPort + ServerDisplay;
debug(4,(stderr, "Server service is on port %d\n", port));
return(port);
}
-short GetScopePort ()
+static short GetScopePort ()
{
short port;
enterprocedure("GetScopePort");
+#if defined(DNETCONN) || defined(DNETSVR4)
+ if (decnet_in) {
+ port = ServerInPort + ServerDisplay;
+ return(port);
+ }
+#endif
port = ServerBasePort + ServerInPort + ServerDisplay;
debug(4,(stderr, "scope service is on port %d\n", port));
return(port);
@@ -632,6 +707,7 @@ short GetScopePort ()
/* */
/* ********************************************** */
+static void
Usage()
{
fprintf(stderr, "Usage: xscope\n");
@@ -640,6 +716,9 @@ Usage()
fprintf(stderr, " [-o<out-port>]\n");
fprintf(stderr, " [-d<display-number>]\n");
fprintf(stderr, " [-v<n>] -- verbose output\n");
+#ifdef RAW_MODE
+ fprintf(stderr, " [-r] -- raw output\n");
+#endif
fprintf(stderr, " [-a<n>] -- audio verbose output\n");
fprintf(stderr, " [-q] -- quiet output\n");
fprintf(stderr, " [-D<debug-level>]\n");
@@ -649,14 +728,19 @@ Usage()
}
-char *OfficialName(); /* forward type declaration */
-
+static void
ScanArgs(argc, argv)
int argc;
char **argv;
{
+#if defined(DNETCONN) || defined(DNETSVR4)
+ char *ss;
+#endif
XVerbose = 1 /* default verbose-ness level */;
NasVerbose = 1;
+#ifdef RAW_MODE
+ Raw = 0 ;
+#endif
/* Scan argument list */
while (--argc > 0)
@@ -692,6 +776,13 @@ ScanArgs(argc, argv)
debug(1,(stderr, "Verbose = %d\n", XVerbose));
break;
+#ifdef RAW_MODE
+ case 'r': /* raw mode */
+ Raw = 1 ;
+ debug(1,(stderr, "Raw = %d\n", Raw));
+ break;
+#endif
+
case 'v': /* verbose mode */
XVerbose = atoi(++*argv);
debug(1,(stderr, "Verbose = %d\n", XVerbose));
@@ -712,6 +803,12 @@ ScanArgs(argc, argv)
break;
case 'i':
+#if defined(DNETCONN) || defined(DNETSVR4)
+ if (ss = (char *)strchr(*argv,':')) {
+ decnet_in = 1;
+ *ss = NULL;
+ }
+#endif
ServerInPort = atoi(++*argv);
if (ServerInPort <= 0)
ServerInPort = 0;
@@ -719,8 +816,17 @@ ScanArgs(argc, argv)
break;
case 'h':
- if (++*argv != NULL && **argv != '\0')
- (void)strcpy(ServerHostName, OfficialName(*argv));
+#if defined(DNETCONN) || defined(DNETSVR4)
+ if (ss = (char *)strchr(*argv,':')) {
+ decnet_server = 1;
+ *ss = NULL;
+ strcpy(ServerHostName,++*argv);
+ break;
+ }
+#endif
+ if (++*argv != NULL && **argv != '\0'
+ && (strlen(*argv) < sizeof(ServerHostName)))
+ strcpy(ServerHostName, *argv);
debug(1,(stderr, "ServerHostName=%s\n", ServerHostName));
break;
@@ -739,7 +845,7 @@ ScanArgs(argc, argv)
case 'n': /* NAS server host */
if (++*argv != NULL && **argv != '\0')
- (void)strcpy(AudioServerHostName, OfficialName(*argv));
+ (void)strcpy(AudioServerHostName, *argv);
debug(1,(stderr, "AudioServerHostName=%s\n", AudioServerHostName));
break;
case 't':
@@ -775,7 +881,6 @@ ScanArgs(argc, argv)
/* */
/* ********************************************** */
-int NewConnection ();
int NewAudio ();
main(argc, argv)
@@ -791,14 +896,22 @@ main(argc, argv)
InitializePEX();
#endif
SetUpStdin();
+#if defined(DNETCONN) || defined(DNETSVR4)
+ if (decnet_in)
+ SetUpDECnetConnection(GetScopePort(), NewConnection);
+ else
+ SetUpConnectionSocket(GetScopePort(), NewConnection);
+#else
SetUpConnectionSocket(GetScopePort(), NewConnection);
if (DoAudio)
SetUpConnectionSocket (GetScopePort() + 2000, NewAudio);
SetSignalHandling();
+#endif
- MainLoop();
+ return MainLoop();
}
+void
TimerExpired()
{
debug(16,(stderr, "Timer tick\n"));
@@ -820,6 +933,7 @@ TimerExpired()
(e) allow fake events, errors to be generated.
*/
+static void
ReadStdin(fd)
FD fd;
{
@@ -831,10 +945,11 @@ ReadStdin(fd)
debug(4,(stderr, "read %d bytes from stdin\n", n));
}
+static void
SetUpStdin()
{
enterprocedure("SetUpStdin");
- UsingFD(fileno(stdin), ReadStdin, (int (*)()) NULL);
+ UsingFD(fileno(stdin), ReadStdin, (int (*)()) NULL, NULL);
}
/* ************************************************************ */
@@ -854,6 +969,7 @@ SetUpStdin()
static long clientNumber = 0;
struct fdinfo FDinfo[StaticMaxFD];
+void
SetUpPair(client, server)
FD client;
FD server;
@@ -879,7 +995,7 @@ SetUpPair(client, server)
}
else if (server >= 0)
{
- (void)close(server);
+ close(server);
NotUsingFD(server);
}
}
@@ -903,6 +1019,7 @@ ResetPair (client, server)
}
}
+static void
CloseConnection(fd)
FD fd;
{
@@ -911,9 +1028,14 @@ CloseConnection(fd)
StopClientConnection(ServerHalf(fd));
StopServerConnection(ClientHalf(fd));
- (void)close(fd);
+#ifdef USE_XTRANS
+ _X11TransClose(GetXTransConnInfo(fd));
+ _X11TransClose(GetXTransConnInfo(FDPair(fd)));
+#else
+ close(fd);
+ close(FDPair(fd));
+#endif
NotUsingFD(fd);
- (void)close(FDPair(fd));
NotUsingFD(FDPair(fd));
if (TerminateClose)
exit (0);
@@ -948,6 +1070,8 @@ char *ClientName (fd)
{
static char name[12];
+ if (clientNumber <= 1)
+ return("");
(void)sprintf(name, " %d", FDinfo[fd].ClientNumber);
return(name);
}
@@ -967,6 +1091,7 @@ int ClientNumber (fd)
* Block reads from the sender until the receiver gets all of the
* data
*/
+void
FlushFD (fd)
FD fd;
{
@@ -1023,6 +1148,7 @@ FlushFD (fd)
server for this client, then dump it to the client. Note, we don't
have to have a server, if there isn't one. */
+static void
DataFromClient(fd)
FD fd;
{
@@ -1076,6 +1202,7 @@ DataFromClient(fd)
/* similar situation for the server, but note that if there is no client,
we close the connection down -- don't need a server with no client. */
+static void
DataFromServer(fd)
FD fd;
{
@@ -1125,34 +1252,104 @@ DataFromServer(fd)
/* */
/* ************************************************************ */
+#include <sys/types.h> /* needed by sys/socket.h and netinet/in.h */
+#include <sys/uio.h> /* for struct iovec, used by socket.h */
+#include <sys/socket.h> /* for AF_INET, SOCK_STREAM, ... */
+#include <sys/ioctl.h> /* for FIONCLEX, FIONBIO, ... */
+#include <netinet/in.h> /* struct sockaddr_in */
+#include <netdb.h> /* struct servent * and struct hostent * */
+#include <errno.h> /* for EINTR, EADDRINUSE, ... */
+extern int errno;
+
static int ON = 1 /* used in ioctl */ ;
+void
NewConnection(fd)
FD fd;
{
FD ServerFD = -1;
FD ClientFD = -1;
+#ifdef DNETCONN
+ if (decnet_in)
+ ClientFD = ConnectToDECnetClient(fd);
+ else
+ ClientFD = ConnectToClient(fd);
+ if (decnet_server)
+ ServerFD = ConnectToDECnetServer(true);
+ else
+ ServerFD = ConnectToServer(true);
+#endif
+#ifdef DNETSVR4
+ ClientFD = ConnectToClient(fd);
+ if (decnet_server) {
+ if (!initialize_libdni()) {
+ fprintf(stderr,"Unable to open libdni.so\n");
+ exit(0);
+ }
+ ServerFD = ConnectToDECnetSVR4Server(true);
+ }
+ else
+ ServerFD = ConnectToServer(true);
+#endif
+#if !(defined(DNETCONN)) && !(defined(DNETSVR4))
ClientFD = ConnectToClient(fd);
ServerFD = ConnectToServer(true);
+
+#endif
SetUpPair(ClientFD, ServerFD);
}
/* ************************************************************ */
-FD ConnectToClient(ConnectionSocket)
+static FD ConnectToClient(ConnectionSocket)
FD ConnectionSocket;
{
FD ClientFD;
+ XtransConnInfo trans_conn = NULL;
+#ifdef USE_XTRANS
+ XtransConnInfo listen_conn;
+ int status;
+#else
+ struct sockaddr_in from;
+ int len = sizeof (from);
+#endif
+
+ enterprocedure("ConnectToClient");
+
+#ifdef USE_XTRANS
+ listen_conn = GetXTransConnInfo(ConnectionSocket);
+ if ((trans_conn = _X11TransAccept (listen_conn, &status)) == NULL) {
+ debug(4,(stderr, "Failed to accept connection\n"));
+ return -1;
+ }
+ _X11TransSetOption(trans_conn, TRANS_NONBLOCKING, 1);
+ ClientFD = _X11TransGetConnectionNumber(trans_conn);
+#else
ClientFD = AcceptConnection(ConnectionSocket);
- UsingFD(ClientFD, DataFromClient, FlushFD);
+#endif
+ debug(4,(stderr, "Connect To Client: FD %d\n", ClientFD));
+ if (ClientFD < 0 && errno == EWOULDBLOCK)
+ {
+ debug(4,(stderr, "Almost blocked accepting FD %d\n", ClientFD));
+ panic("Can't connect to Client");
+ }
+ if (ClientFD < 0)
+ {
+ debug(4,(stderr, "NewConnection: error %d\n", errno));
+ panic("Can't connect to Client");
+ }
+
+ UsingFD(ClientFD, DataFromClient, FlushFD, trans_conn);
+#ifndef USE_XTRANS
+ ioctl(ClientFD, FIOCLEX, 0);
+ ioctl(ClientFD, FIONBIO, &ON);
+#endif
StartClientConnection(ClientFD);
return(ClientFD);
}
-
-
/* ************************************************************ */
/* */
/* */
@@ -1164,32 +1361,180 @@ FD ConnectToServer(report)
Boolean report;
{
FD ServerFD;
- ServerFD = MakeConnection (ServerHostName, GetServerport (), report);
+ XtransConnInfo trans_conn = NULL; /* transport connection object */
+ short port;
+
+ enterprocedure("ConnectToServer");
+
+ port = GetServerport ();
+
+ if (port == ScopePort &&
+ ((ServerHostName[0] == '\0') || strcmp(ServerHostName, ScopeHost) == 0))
+ {
+ char error_message[100];
+ sprintf(error_message, "Trying to attach to myself: %s,%d\n",
+ ServerHostName, port);
+ panic(error_message);
+ }
+
+ ServerFD = MakeConnection (ServerHostName, port, report, &trans_conn);
+
+ debug(4,(stderr, "Connect To Server: FD %d\n", ServerFD));
if (ServerFD >= 0)
{
- UsingFD(ServerFD, DataFromServer, FlushFD);
+ UsingFD(ServerFD, DataFromServer, FlushFD, trans_conn);
StartServerConnection(ServerFD);
}
return(ServerFD);
}
+#ifdef DNETSVR4
+FD ConnectToDECnetSVR4Server(report)
+ Boolean report;
+{
+ FD ServerFD;
+ struct sockaddr_dn sdn;
+ struct hostent *hp;
+
+ enterprocedure("ConnectToServer");
+
+ /* establish a socket to the name server for this host */
+ ServerFD = socket(AF_DECnet, SOCK_STREAM, 0);
+ if (ServerFD < 0)
+ {
+ perror("socket() to Server failed");
+ debug(1,(stderr, "socket failed\n"));
+ panic("Can't open connection to Server");
+ }
+ (void) setsockopt(ServerFD, SOL_SOCKET, SO_REUSEADDR, (char *) NULL, 0);
+ (void) setsockopt(ServerFD, SOL_SOCKET, SO_USELOOPBACK,(char *) NULL, 0);
+ /* determine the host machine for this process */
+ initialize_libdni();
+ if (ServerHostName[0] == '\0')
+ (dnet_gethostname)(ServerHostName);
+ debug(4,(stderr, "try to connect on %s\n", ServerHostName));
+
+ hp = (struct hostent *)(dnet_gethostbyname)(ServerHostName);
+ if (hp == 0)
+ {
+ perror("gethostbyname failed");
+ debug(1,(stderr, "gethostbyname failed for %s\n", ServerHostName));
+ panic("Can't open connection to Server");
+ }
+
+ sdn.sdn_family = AF_DECnet;
+ sdn.sdn_format = DNADDR_FMT1;
+ sdn.sdn_port = 0;
+ sprintf (sdn.sdn_name, "X$X%d", GetServerport() );
+ sdn.sdn_namelen = strlen(sdn.sdn_name);
+ sdn.sdn_addr = *(u_short *)hp->h_addr_list[0];
+
+ /* ******************************************************** */
+ /* try to connect to Server */
+
+ if (connect(ServerFD, (struct sockaddr *)&sdn, sizeof(sdn)) < 0)
+ {
+ debug(4,(stderr, "connect returns errno of %d\n", errno));
+ if (errno != 0)
+ if (report)
+ perror("connect");
+ switch (errno)
+ {
+ case ECONNREFUSED:
+ /* experience says this is because there is no Server
+ to connect to */
+ close(ServerFD);
+ debug(1,(stderr, "No Server\n"));
+ if (report)
+ warn("Can't open connection to Server");
+ return(-1);
+
+ default:
+ close(ServerFD);
+ panic("Can't open connection to Server");
+ }
+ }
+
+ debug(4,(stderr, "Connect To Server: FD %d\n", ServerFD));
+ if (ServerFD >= 0)
+ {
+ UsingFD(ServerFD, DataFromServer, FlushFD, NULL);
+ StartServerConnection(ServerFD);
+ }
+ return(ServerFD);
+}
+#endif
/* ********************************************** */
/* */
/* ********************************************** */
-char *OfficialName(name)
-char *name;
+#ifdef DNETCONN
+FD ConnectToDECnetClient(fd)
+ FD fd;
{
- struct hostent *HostEntry;
-
- HostEntry = gethostbyname(name);
- if (HostEntry == NULL)
- {
- perror("gethostbyname");
- exit(-1);
- }
- debug(4,(stderr, "Official name of %s is %s\n", name, HostEntry->h_name));
- return(HostEntry->h_name);
+ struct ses_io_type sesopts;
+ static SessionData sd= {0, {0, ""}};
+
+ if (ioctl(fd, SES_ACCEPT, &sd) < 0) {
+ fprintf(stderr,"xscope: dni: SES_ACCEPT failed\n");
+ exit(-1);
+ }
+ UsingFD(fd, DataFromClient, NULL, NULL);
+ StartClientConnection(fd);
+ /* unlike sockets, dni consumes the fd on which it was listening */
+ /* in order to accept new logical link requests using the same name */
+ /* we must re-open the logical link device and re-supply the */
+ /* appropriate access control information */
+
+ SetUpDECnetConnection(GetScopePort());
+
+ return(fd);
}
+
+FD ConnectToDECnetServer(report)
+ Boolean report;
+{
+ FD fd;
+ OpenBlock opblk;
+ struct ses_io_type sesopts;
+ struct nodeent *np;
+
+ if ((fd = open("/dev/dni", O_RDWR)) < 0) {
+ fprintf(stderr,"xscope: dni: open failed\n");
+ exit(-1);
+ }
+ if (ioctl(fd, SES_GET_LINK, 0)) {
+ fprintf(stderr,"xscope: dni: can't get link\n");
+ exit(-1);
+ }
+
+ /* set nonblocking here since dni can't handle fcntls */
+ sesopts.io_flags = SES_IO_NBIO;
+ sesopts.io_io_signal = sesopts.io_int_signal = 0;
+
+ if (ioctl(fd, SES_IO_TYPE, &sesopts) < 0) {
+ fprintf(stderr,"xscope: dni: ioctl failed\n");
+ exit(-1);
+ }
+
+ strncpy(opblk.op_node_name,ServerHostName , 6); /* dni server name */
+ opblk.op_node_name[6] = '\0';
+ sprintf(opblk.op_task_name, "X$X%d", GetServerport());
+ opblk.op_userid[0] = '\0'; /* No one checks our id */
+ opblk.op_object_nbr = 0; /* Any fields not used */
+ opblk.op_account[0] = '\0'; /* should be set to zero */
+ opblk.op_password[0] = '\0';
+ opblk.op_opt_data.im_length = 0;
+
+ if (ioctl(fd, SES_LINK_ACCESS, &opblk) == -1) {
+ fprintf(stderr,"xscope: dni: cannot connect to server\n");
+ exit(-1);
+ }
+ UsingFD(fd, DataFromServer, NULL, NULL);
+ StartServerConnection(fd);
+ return(fd);
+
+}
+#endif
diff --git a/scope.h b/scope.h
index a64bac5..8284d70 100644
--- a/scope.h
+++ b/scope.h
@@ -1,6 +1,6 @@
/* **********************************************
* *
- * header file for the Server spy scope *
+ * header file for the Server spy scope *
* *
* James Peterson, 1987 *
* Copyright (C) 1987 MCC
@@ -23,11 +23,44 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* *
+ * *
+ * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
********************************************** */
#include <X11/Xos.h>
#include <X11/Xfuncs.h>
#include <stdio.h>
+#include <netdb.h>
+#ifdef SVR4
+#include <sys/filio.h>
+#endif /* SVR4 */
+
#define Boolean short
#define true 1
#define false 0
@@ -49,6 +82,11 @@ extern short debuglevel;
extern short Verbose /* quiet (0) or increasingly verbose ( > 0) */ ;
extern short XVerbose;
extern short NasVerbose;
+#ifdef RAW_MODE
+extern short Raw /* raw data output only */ ;
+#else
+#define Raw 0
+#endif
extern int ScopePort;
@@ -58,20 +96,27 @@ extern int Interrupt, SingleStep, BreakPoint;
extern void ReadCommands ();
-extern char ServerHostName[255];
-extern char AudioServerHostName[255];
+extern char ServerHostName[MAXHOSTNAMELEN];
+extern char AudioServerHostName[MAXHOSTNAMELEN];
/* external function type declarations */
-extern char *Malloc ();
-extern char *ClientName ();
+extern void *Malloc (long n);
+#ifdef X_NOT_STDC_ENV
+extern char *strcpy();
+extern char *sprintf();
+#else
+#include <stdlib.h>
+#include <string.h>
+#endif
+extern char *ClientName();
/* ********************************************** */
/* */
/* ********************************************** */
-/* need to change the MaxFD to allow larger number of fd's */
-#define StaticMaxFD 1024
+#include "fd.h"
+#include "proto.h"
#define BUFFER_SIZE (1024 * 32)
diff --git a/server.c b/server.c
index d1bc769..2d78fd9 100644
--- a/server.c
+++ b/server.c
@@ -23,11 +23,44 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* *
+ * *
+ * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
* ************************************************** */
#include "scope.h"
#include "x11.h"
+#ifdef SYSV
+#define bzero(s,l) memset(s, 0, l)
+#define bcopy(s,d,l) memmove(d,s,l)
+#endif
+
struct TypeDef TD[MaxTypes];
unsigned char RBf[2];
unsigned char SBf[4];
@@ -40,6 +73,7 @@ extern char ScopeEnabled;
/* */
/* ************************************************************ */
+void
ReportFromClient(fd, buf, n)
FD fd;
unsigned char *buf;
@@ -56,6 +90,7 @@ ReportFromClient(fd, buf, n)
ProcessBuffer(fd, buf, n);
}
+void
ReportFromServer(fd, buf, n)
FD fd;
unsigned char *buf;
@@ -83,13 +118,14 @@ static struct timeval tp;
/* print the time since we started in hundredths (1/100) of seconds */
+void
PrintTime()
{
static long lastsec = 0;
long sec /* seconds */ ;
long hsec /* hundredths of a second */ ;
- (void)gettimeofday(&tp, (struct timezone *)NULL);
+ gettimeofday(&tp, (struct timezone *)NULL);
if (ZeroTime1 == -1 || (tp.tv_sec - lastsec) >= 1000)
{
ZeroTime1 = tp.tv_sec;
@@ -174,6 +210,7 @@ Boolean IBool(buf)
/* we will need to save bytes until we get a complete request to
interpret. The following procedures provide this ability */
+static void
SaveBytes(fd, buf, n)
FD fd;
unsigned char *buf;
@@ -185,13 +222,10 @@ SaveBytes(fd, buf, n)
/* not enough room so far; malloc more space and copy */
long SizeofNewBytes = (CS[fd].NumberofSavedBytes + n + 1);
unsigned char *NewBytes = (unsigned char *)Malloc (SizeofNewBytes);
- if (CS[fd].NumberofSavedBytes > 0)
- {
- bcopy(/* from */(char *)CS[fd].SavedBytes,
- /* to */(char *)NewBytes,
- /* count */(int)CS[fd].NumberofSavedBytes);
- Free((char *)CS[fd].SavedBytes);
- }
+ bcopy(/* from */(char *)CS[fd].SavedBytes,
+ /* to */(char *)NewBytes,
+ /* count */(int)CS[fd].SizeofSavedBytes);
+ Free((char *)CS[fd].SavedBytes);
CS[fd].SavedBytes = NewBytes;
CS[fd].SizeofSavedBytes = SizeofNewBytes;
}
@@ -203,6 +237,7 @@ SaveBytes(fd, buf, n)
CS[fd].NumberofSavedBytes += n;
}
+static void
RemoveSavedBytes(fd, n)
FD fd;
long n;
@@ -233,15 +268,13 @@ RemoveSavedBytes(fd, n)
/* following are the possible values for ByteProcessing */
/* forward declarations */
-long StartSetUpMessage ();
-long FinishSetUpMessage ();
-long StartRequest ();
-long FinishRequest ();
+static long FinishSetUpMessage(FD fd, unsigned char *buf, long n);
+static long StartRequest(FD fd, unsigned char *buf, long n);
+static long FinishRequest(FD fd, unsigned char *buf, long n);
-long StartSetUpReply ();
-long FinishSetUpReply ();
-long ServerPacket ();
-long FinishReply ();
+static long FinishSetUpReply(FD fd, unsigned char *buf, long n);
+static long ServerPacket(FD fd, unsigned char *buf, long n);
+static long FinishReply(FD fd, unsigned char *buf, long n);
/* ************************************************************ */
@@ -251,6 +284,7 @@ long FinishReply ();
int littleEndian;
+void
ProcessBuffer(fd, buf, n)
FD fd;
unsigned char *buf;
@@ -411,6 +445,7 @@ FinishStuff (fd, buf, n)
}
}
+void
StartClientConnection(fd)
FD fd;
{
@@ -433,6 +468,7 @@ StartClientConnection(fd)
StartStuff (fd);
}
+void
StopClientConnection(fd)
FD fd;
{
@@ -448,8 +484,8 @@ long StartSetUpMessage (fd, buf, n)
unsigned char *buf;
long n;
{
- short namelength;
- short datalength;
+ unsigned short namelength;
+ unsigned short datalength;
enterprocedure("StartSetUpMessage");
/*
@@ -473,12 +509,17 @@ long StartSetUpMessage (fd, buf, n)
return(0);
}
-long FinishSetUpMessage (fd, buf, n)
+static long FinishSetUpMessage (fd, buf, n)
FD fd;
unsigned char *buf;
long n;
{
enterprocedure("FinishSetUpMessage");
+ if( Raw || (Verbose > 3) )
+ DumpItem("Client Connect", fd, buf, n) ;
+ CS[fd].littleEndian = (buf[0] == 'l');
+ CS[ServerHalf(fd)].littleEndian = CS[fd].littleEndian;
+ littleEndian = CS[fd].littleEndian;
if (ScopeEnabled)
PrintSetUpMessage(buf);
@@ -498,6 +539,7 @@ long StartBigRequest (fd, buf, n)
/* bytes 0-3 are ignored now; bytes 4-8 tell us the request length */
CS[fd].requestLen = ILong(&buf[4]);
+
CS[fd].ByteProcessing = FinishRequest;
CS[fd].NumberofBytesNeeded = 4 * CS[fd].requestLen;
debug(8,(stderr, "need %d more bytes to finish request\n",
@@ -506,7 +548,7 @@ long StartBigRequest (fd, buf, n)
return(0);
}
-long StartRequest (fd, buf, n)
+static long StartRequest (fd, buf, n)
FD fd;
unsigned char *buf;
long n;
@@ -534,7 +576,7 @@ long StartRequest (fd, buf, n)
}
-long FinishRequest (fd, buf, n)
+static long FinishRequest (fd, buf, n)
FD fd;
unsigned char *buf;
long n;
@@ -553,6 +595,7 @@ long FinishRequest (fd, buf, n)
/* */
/* ************************************************************ */
+void
StartServerConnection(fd)
FD fd;
{
@@ -571,6 +614,7 @@ StartServerConnection(fd)
CS[fd].NumberofBytesNeeded = 8;
}
+void
StopServerConnection(fd)
FD fd;
{
@@ -581,12 +625,13 @@ StopServerConnection(fd)
Free((char *)CS[fd].SavedBytes);
}
-long StartSetUpReply (fd, buf, n)
+long
+StartSetUpReply (fd, buf, n)
FD fd;
unsigned char *buf;
long n;
{
- short replylength;
+ unsigned short replylength;
enterprocedure("StartSetUpReply");
replylength = IShort(&buf[6]);
@@ -597,12 +642,15 @@ long StartSetUpReply (fd, buf, n)
return(0);
}
-long FinishSetUpReply (fd, buf, n)
+static long
+FinishSetUpReply (fd, buf, n)
FD fd;
unsigned char *buf;
long n;
{
enterprocedure("FinishSetUpReply");
+ if( Raw || (Verbose > 3) )
+ DumpItem("Server Connect", fd, buf, n) ;
if (ScopeEnabled)
PrintSetUpReply(buf);
CS[fd].ByteProcessing = ServerPacket;
@@ -612,7 +660,8 @@ long FinishSetUpReply (fd, buf, n)
/* ************************************************************ */
-long ErrorPacket (fd, buf, n)
+static long
+ErrorPacket (fd, buf, n)
FD fd;
unsigned char *buf;
long n;
@@ -624,7 +673,8 @@ long ErrorPacket (fd, buf, n)
}
-long EventPacket (fd, buf, n)
+static long
+EventPacket (fd, buf, n)
FD fd;
unsigned char *buf;
long n;
@@ -637,7 +687,8 @@ long EventPacket (fd, buf, n)
}
-long ReplyPacket (fd, buf, n)
+static long
+ReplyPacket (fd, buf, n)
FD fd;
unsigned char *buf;
long n;
@@ -662,7 +713,8 @@ long ReplyPacket (fd, buf, n)
return(0);
}
-long ServerPacket (fd, buf, n)
+static long
+ServerPacket (fd, buf, n)
FD fd;
unsigned char *buf;
long n;
diff --git a/table11.c b/table11.c
index d3e08ed..9095adf 100644
--- a/table11.c
+++ b/table11.c
@@ -23,11 +23,65 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* *
+ * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
* ************************************************** */
#include "scope.h"
#include "x11.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+static void InitBuiltInTypes(void);
+static void InitEnumeratedTypes(void);
+static void InitSetTypes(void);
+static void InitRecordTypes(void);
+static void InitValuesTypes(void);
+
+static int PrintCHAR2B(unsigned char *buf);
+static int PrintPOINT(unsigned char *buf);
+static int PrintRECTANGLE(unsigned char *buf);
+static int PrintARC(unsigned char *buf);
+static int PrintHOST(unsigned char *buf);
+static int PrintTIMECOORD(unsigned char *buf);
+static int PrintFONTPROP(unsigned char *buf);
+static int PrintCHARINFO(unsigned char *buf);
+static int PrintSEGMENT(unsigned char *buf);
+static int PrintCOLORITEM(unsigned char *buf);
+static int PrintRGB(unsigned char *buf);
+static int PrintFORMAT(unsigned char *buf);
+static int PrintSCREEN(unsigned char *buf);
+static int PrintDEPTH(unsigned char *buf);
+static int PrintVISUALTYPE(unsigned char *buf);
+
/*
To initialize for the X11 protocol, we need to create data structures
describing the data types used by X11.
@@ -56,7 +110,7 @@
(index) and the bytes in memory that are its value.
*/
-
+void
InitializeX11()
{
InitReplyQ();
@@ -171,11 +225,12 @@ SetValueRec (key, control, clength, ctype, values)
/* define the various types */
-TYPE DefineType(typeid, class, name, printproc)
+TYPE
+DefineType(typeid, class, name, printproc)
short typeid;
short class;
char *name;
- int (*printproc)();
+ int (*printproc)(unsigned char *);
{
TD[typeid].Name = name;
TD[typeid].Type = class;
@@ -187,6 +242,7 @@ TYPE DefineType(typeid, class, name, printproc)
/* ************************************************************ */
/* define an Enumerated Value (or a Set Value) */
+void
DefineEValue(type, value, name)
TYPE type;
long value;
@@ -244,10 +300,8 @@ GetEValue (typeid, name)
we have an associated value. We need to know the length and type of the
associated value for each bit */
-DefineValues(type, value, length, ctype, name)
- TYPE type;
- long value;
- char *name;
+void
+DefineValues(TYPE type, long value, short length, short ctype, char *name)
{
struct ValueListEntry *p;
@@ -279,6 +333,7 @@ DefineValues(type, value, length, ctype, name)
/* ************************************************************ */
+static void
InitBuiltInTypes()
{
(void) DefineType(INT8, BUILTIN, "INT8", PrintINT8);
@@ -323,11 +378,12 @@ InitBuiltInTypes()
/* */
/* ************************************************************ */
+static void
InitEnumeratedTypes()
{
TYPE p;
- p = DefineType(REQUEST, ENUMERATED, "REQUEST", PrintENUMERATED);
+ p = DefineType(REQUEST, ENUMERATED, "REQUEST", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 1L, "CreateWindow");
DefineEValue(p, 2L, "ChangeWindowAttributes");
DefineEValue(p, 3L, "GetWindowAttributes");
@@ -449,7 +505,7 @@ InitEnumeratedTypes()
DefineEValue(p, 119L, "GetModifierMapping");
DefineEValue(p, 127L, "NoOperation");
- p = DefineType(REPLY, ENUMERATED, "REPLY", PrintENUMERATED);
+ p = DefineType(REPLY, ENUMERATED, "REPLY", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 3L, "GetWindowAttributes");
DefineEValue(p, 14L, "GetGeometry");
DefineEValue(p, 15L, "QueryTree");
@@ -491,7 +547,7 @@ InitEnumeratedTypes()
DefineEValue(p, 118L, "SetModifierMapping");
DefineEValue(p, 119L, "GetModifierMapping");
- p = DefineType(ERROR, ENUMERATED, "ERROR", PrintENUMERATED);
+ p = DefineType(ERROR, ENUMERATED, "ERROR", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 1L, "Request");
DefineEValue(p, 2L, "Value");
DefineEValue(p, 3L, "Window");
@@ -510,7 +566,7 @@ InitEnumeratedTypes()
DefineEValue(p, 16L, "Length");
DefineEValue(p, 17L, "Implementation");
- p = DefineType(EVENT, ENUMERATED, "EVENT", PrintENUMERATED);
+ p = DefineType(EVENT, ENUMERATED, "EVENT", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 2L, "KeyPress");
DefineEValue(p, 3L, "KeyRelease");
DefineEValue(p, 4L, "ButtonPress");
@@ -545,42 +601,8 @@ InitEnumeratedTypes()
DefineEValue(p, 33L, "ClientMessage");
DefineEValue(p, 34L, "MappingNotify");
- DefineEValue(p, 0x80L | 2L, "KeyPress (from SendEvent)");
- DefineEValue(p, 0x80L | 3L, "KeyRelease (from SendEvent)");
- DefineEValue(p, 0x80L | 4L, "ButtonPress (from SendEvent)");
- DefineEValue(p, 0x80L | 5L, "ButtonRelease (from SendEvent)");
- DefineEValue(p, 0x80L | 6L, "MotionNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 7L, "EnterNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 8L, "LeaveNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 9L, "FocusIn (from SendEvent)");
- DefineEValue(p, 0x80L | 10L, "FocusOut (from SendEvent)");
- DefineEValue(p, 0x80L | 11L, "KeymapNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 12L, "Expose (from SendEvent)");
- DefineEValue(p, 0x80L | 13L, "GraphicsExposure (from SendEvent)");
- DefineEValue(p, 0x80L | 14L, "NoExposure (from SendEvent)");
- DefineEValue(p, 0x80L | 15L, "VisibilityNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 16L, "CreateNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 17L, "DestroyNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 18L, "UnmapNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 19L, "MapNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 20L, "MapRequest (from SendEvent)");
- DefineEValue(p, 0x80L | 21L, "ReparentNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 22L, "ConfigureNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 23L, "ConfigureRequest (from SendEvent)");
- DefineEValue(p, 0x80L | 24L, "GravityNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 25L, "ResizeRequest (from SendEvent)");
- DefineEValue(p, 0x80L | 26L, "CirculateNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 27L, "CirculateRequest (from SendEvent)");
- DefineEValue(p, 0x80L | 28L, "PropertyNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 29L, "SelectionClear (from SendEvent)");
- DefineEValue(p, 0x80L | 30L, "SelectionRequest (from SendEvent)");
- DefineEValue(p, 0x80L | 31L, "SelectionNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 32L, "ColormapNotify (from SendEvent)");
- DefineEValue(p, 0x80L | 33L, "ClientMessage (from SendEvent)");
- DefineEValue(p, 0x80L | 34L, "MappingNotify (from SendEvent)");
-
-
- p = DefineType(BITGRAVITY, ENUMERATED, "BITGRAVITY", PrintENUMERATED);
+
+ p = DefineType(BITGRAVITY, ENUMERATED, "BITGRAVITY", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Forget");
DefineEValue(p, 1L, "NorthWest");
DefineEValue(p, 2L, "North");
@@ -593,7 +615,7 @@ InitEnumeratedTypes()
DefineEValue(p, 9L, "SouthEast");
DefineEValue(p, 10L, "Static");
- p = DefineType(WINGRAVITY, ENUMERATED, "WINGRAVITY", PrintENUMERATED);
+ p = DefineType(WINGRAVITY, ENUMERATED, "WINGRAVITY", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Unmap");
DefineEValue(p, 1L, "NorthWest");
DefineEValue(p, 2L, "North");
@@ -606,63 +628,67 @@ InitEnumeratedTypes()
DefineEValue(p, 9L, "SouthEast");
DefineEValue(p, 10L, "Static");
- p = DefineType(BOOL, ENUMERATED, "BOOL", PrintENUMERATED);
+ p = DefineType(BOOL, ENUMERATED, "BOOL", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "False");
DefineEValue(p, 1L, "True");
- p = DefineType(HOSTFAMILY, ENUMERATED, "HOSTFAMILY", PrintENUMERATED);
+ p = DefineType(HOSTFAMILY, ENUMERATED, "HOSTFAMILY", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Internet");
DefineEValue(p, 1L, "DECnet");
DefineEValue(p, 2L, "Chaos");
+ DefineEValue(p, 6L, "InternetV6");
+ DefineEValue(p, 252L, "LocalHost");
+ DefineEValue(p, 253L, "Kerberos5");
+ DefineEValue(p, 254L, "SecureRPC");
- p = DefineType(PK_MODE, ENUMERATED, "PK_MODE", PrintENUMERATED);
+ p = DefineType(PK_MODE, ENUMERATED, "PK_MODE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Synchronous");
DefineEValue(p, 1L, "Asynchronous");
- p = DefineType(NO_YES, ENUMERATED, "NO_YES", PrintENUMERATED);
+ p = DefineType(NO_YES, ENUMERATED, "NO_YES", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "No");
DefineEValue(p, 1L, "Yes");
DefineEValue(p, 2L, "Default");
- p = DefineType(WINDOWCLASS, ENUMERATED, "WINDOWCLASS", PrintENUMERATED);
+ p = DefineType(WINDOWCLASS, ENUMERATED, "WINDOWCLASS", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "CopyFromParent");
DefineEValue(p, 1L, "InputOutput");
DefineEValue(p, 2L, "InputOnly");
- p = DefineType(BACKSTORE, ENUMERATED, "BACKSTORE", PrintENUMERATED);
+ p = DefineType(BACKSTORE, ENUMERATED, "BACKSTORE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "NotUseful");
DefineEValue(p, 1L, "WhenMapped");
DefineEValue(p, 2L, "Always");
- p = DefineType(MAPSTATE, ENUMERATED, "MAPSTATE", PrintENUMERATED);
+ p = DefineType(MAPSTATE, ENUMERATED, "MAPSTATE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Unmapped");
DefineEValue(p, 1L, "Unviewable");
DefineEValue(p, 2L, "Viewable");
- p = DefineType(STACKMODE, ENUMERATED, "STACKMODE", PrintENUMERATED);
+ p = DefineType(STACKMODE, ENUMERATED, "STACKMODE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Above");
DefineEValue(p, 1L, "Below");
DefineEValue(p, 2L, "TopIf");
DefineEValue(p, 3L, "BottomIf");
DefineEValue(p, 4L, "Opposite");
- p = DefineType(CIRMODE, ENUMERATED, "CIRMODE", PrintENUMERATED);
+ p = DefineType(CIRMODE, ENUMERATED, "CIRMODE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "RaiseLowest");
DefineEValue(p, 1L, "LowerHighest");
- p = DefineType(CHANGEMODE, ENUMERATED, "CHANGEMODE", PrintENUMERATED);
+ p = DefineType(CHANGEMODE, ENUMERATED, "CHANGEMODE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Replace");
DefineEValue(p, 1L, "Prepend");
DefineEValue(p, 2L, "Append");
- p = DefineType(GRABSTAT, ENUMERATED, "GRABSTAT", PrintENUMERATED);
+ p = DefineType(GRABSTAT, ENUMERATED, "GRABSTAT", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Success");
DefineEValue(p, 1L, "AlreadyGrabbed");
DefineEValue(p, 2L, "InvalidTime");
DefineEValue(p, 3L, "NotViewable");
DefineEValue(p, 4L, "Frozen");
- p = DefineType(EVENTMODE, ENUMERATED, "EVENTMODE", PrintENUMERATED);
+ p = DefineType(EVENTMODE, ENUMERATED, "EVENTMODE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "AsyncPointer");
DefineEValue(p, 1L, "SyncPointer");
DefineEValue(p, 2L, "ReplayPointer");
@@ -672,16 +698,16 @@ InitEnumeratedTypes()
DefineEValue(p, 6L, "AsyncBoth");
DefineEValue(p, 7L, "SyncBoth");
- p = DefineType(FOCUSAGENT, ENUMERATED, "FOCUSAGENT", PrintENUMERATED);
+ p = DefineType(FOCUSAGENT, ENUMERATED, "FOCUSAGENT", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "None");
DefineEValue(p, 1L, "PointerRoot");
DefineEValue(p, 2L, "Parent");
- p = DefineType(DIRECT, ENUMERATED, "DIRECT", PrintENUMERATED);
+ p = DefineType(DIRECT, ENUMERATED, "DIRECT", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "LeftToRight");
DefineEValue(p, 1L, "RightToLeft");
- p = DefineType(GCFUNC, ENUMERATED, "GCFUNC", PrintENUMERATED);
+ p = DefineType(GCFUNC, ENUMERATED, "GCFUNC", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Clear");
DefineEValue(p, 1L, "And");
DefineEValue(p, 2L, "AndReverse");
@@ -699,101 +725,101 @@ InitEnumeratedTypes()
DefineEValue(p, 14L, "Nand");
DefineEValue(p, 15L, "Set");
- p = DefineType(LINESTYLE, ENUMERATED, "LINESTYLE", PrintENUMERATED);
+ p = DefineType(LINESTYLE, ENUMERATED, "LINESTYLE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Solid");
DefineEValue(p, 1L, "OnOffDash");
DefineEValue(p, 2L, "DoubleDash");
- p = DefineType(CAPSTYLE, ENUMERATED, "CAPSTYLE", PrintENUMERATED);
+ p = DefineType(CAPSTYLE, ENUMERATED, "CAPSTYLE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "NotLast");
DefineEValue(p, 1L, "Butt");
DefineEValue(p, 2L, "Round");
DefineEValue(p, 3L, "Projecting");
- p = DefineType(JOINSTYLE, ENUMERATED, "JOINSTYLE", PrintENUMERATED);
+ p = DefineType(JOINSTYLE, ENUMERATED, "JOINSTYLE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Miter");
DefineEValue(p, 1L, "Round");
DefineEValue(p, 2L, "Bevel");
- p = DefineType(FILLSTYLE, ENUMERATED, "FILLSTYLE", PrintENUMERATED);
+ p = DefineType(FILLSTYLE, ENUMERATED, "FILLSTYLE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Solid");
DefineEValue(p, 1L, "Tiled");
DefineEValue(p, 2L, "Stippled");
DefineEValue(p, 3L, "OpaqueStippled");
- p = DefineType(FILLRULE, ENUMERATED, "FILLRULE", PrintENUMERATED);
+ p = DefineType(FILLRULE, ENUMERATED, "FILLRULE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "EvenOdd");
DefineEValue(p, 1L, "Winding");
- p = DefineType(SUBWINMODE, ENUMERATED, "SUBWINMODE", PrintENUMERATED);
+ p = DefineType(SUBWINMODE, ENUMERATED, "SUBWINMODE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "ClipByChildren");
DefineEValue(p, 1L, "IncludeInferiors");
- p = DefineType(ARCMODE, ENUMERATED, "ARCMODE", PrintENUMERATED);
+ p = DefineType(ARCMODE, ENUMERATED, "ARCMODE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Chord");
DefineEValue(p, 1L, "PieSlice");
- p = DefineType(RECTORDER, ENUMERATED, "RECTORDER", PrintENUMERATED);
+ p = DefineType(RECTORDER, ENUMERATED, "RECTORDER", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "UnSorted");
DefineEValue(p, 1L, "YSorted");
DefineEValue(p, 2L, "YXSorted");
DefineEValue(p, 3L, "YXBanded");
- p = DefineType(COORMODE, ENUMERATED, "COORMODE", PrintENUMERATED);
+ p = DefineType(COORMODE, ENUMERATED, "COORMODE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Origin");
DefineEValue(p, 1L, "Previous");
- p = DefineType(POLYSHAPE, ENUMERATED, "POLYSHAPE", PrintENUMERATED);
+ p = DefineType(POLYSHAPE, ENUMERATED, "POLYSHAPE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Complex");
DefineEValue(p, 1L, "Nonconvex");
DefineEValue(p, 2L, "Convex");
- p = DefineType(IMAGEMODE, ENUMERATED, "IMAGEMODE", PrintENUMERATED);
+ p = DefineType(IMAGEMODE, ENUMERATED, "IMAGEMODE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Bitmap");
DefineEValue(p, 1L, "XYPixmap");
DefineEValue(p, 2L, "ZPixmap");
- p = DefineType(ALLORNONE, ENUMERATED, "ALLORNONE", PrintENUMERATED);
+ p = DefineType(ALLORNONE, ENUMERATED, "ALLORNONE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "None");
DefineEValue(p, 1L, "All");
- p = DefineType(OBJECTCLASS, ENUMERATED, "OBJECTCLASS", PrintENUMERATED);
+ p = DefineType(OBJECTCLASS, ENUMERATED, "OBJECTCLASS", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Cursor");
DefineEValue(p, 1L, "Tile");
DefineEValue(p, 2L, "Stipple");
- p = DefineType(OFF_ON, ENUMERATED, "OFF_ON", PrintENUMERATED);
+ p = DefineType(OFF_ON, ENUMERATED, "OFF_ON", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Off");
DefineEValue(p, 1L, "On");
DefineEValue(p, 2L, "Default");
- p = DefineType(INS_DEL, ENUMERATED, "INS_DEL", PrintENUMERATED);
+ p = DefineType(INS_DEL, ENUMERATED, "INS_DEL", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Insert");
DefineEValue(p, 1L, "Delete");
- p = DefineType(DIS_EN, ENUMERATED, "DIS_EN", PrintENUMERATED);
+ p = DefineType(DIS_EN, ENUMERATED, "DIS_EN", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Disabled");
DefineEValue(p, 1L, "Enabled");
- p = DefineType(CLOSEMODE, ENUMERATED, "CLOSEMODE", PrintENUMERATED);
+ p = DefineType(CLOSEMODE, ENUMERATED, "CLOSEMODE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Destroy");
DefineEValue(p, 1L, "RetainPermanent");
DefineEValue(p, 2L, "RetainTemporary");
- p = DefineType(SAVEMODE, ENUMERATED, "SAVEMODE", PrintENUMERATED);
+ p = DefineType(SAVEMODE, ENUMERATED, "SAVEMODE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Reset");
DefineEValue(p, 1L, "Activate");
- p = DefineType(RSTATUS, ENUMERATED, "RSTATUS", PrintENUMERATED);
+ p = DefineType(RSTATUS, ENUMERATED, "RSTATUS", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Success");
DefineEValue(p, 1L, "Busy");
DefineEValue(p, 2L, "Failed");
- p = DefineType(MOTIONDETAIL, ENUMERATED, "MOTIONDETAIL", PrintENUMERATED);
+ p = DefineType(MOTIONDETAIL, ENUMERATED, "MOTIONDETAIL", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Normal");
DefineEValue(p, 1L, "Hint");
- p = DefineType(ENTERDETAIL, ENUMERATED, "ENTERDETAIL", PrintENUMERATED);
+ p = DefineType(ENTERDETAIL, ENUMERATED, "ENTERDETAIL", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Ancestor");
DefineEValue(p, 1L, "Virtual");
DefineEValue(p, 2L, "Inferior");
@@ -803,43 +829,43 @@ InitEnumeratedTypes()
DefineEValue(p, 6L, "PointerRoot");
DefineEValue(p, 7L, "None");
- p = DefineType(BUTTONMODE, ENUMERATED, "BUTTONMODE", PrintENUMERATED);
+ p = DefineType(BUTTONMODE, ENUMERATED, "BUTTONMODE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Normal");
DefineEValue(p, 1L, "Grab");
DefineEValue(p, 2L, "Ungrab");
DefineEValue(p, 3L, "WhileGrabbed");
- p = DefineType(VISIBLE, ENUMERATED, "VISIBLE", PrintENUMERATED);
+ p = DefineType(VISIBLE, ENUMERATED, "VISIBLE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Unobscured");
DefineEValue(p, 1L, "PartiallyObscured");
DefineEValue(p, 2L, "FullyObscured");
- p = DefineType(CIRSTAT, ENUMERATED, "CIRSTAT", PrintENUMERATED);
+ p = DefineType(CIRSTAT, ENUMERATED, "CIRSTAT", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Top");
DefineEValue(p, 1L, "Bottom");
- p = DefineType(PROPCHANGE, ENUMERATED, "PROPCHANGE", PrintENUMERATED);
+ p = DefineType(PROPCHANGE, ENUMERATED, "PROPCHANGE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "NewValue");
DefineEValue(p, 1L, "Deleted");
- p = DefineType(CMAPCHANGE, ENUMERATED, "CMAPCHANGE", PrintENUMERATED);
+ p = DefineType(CMAPCHANGE, ENUMERATED, "CMAPCHANGE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Uninstalled");
DefineEValue(p, 1L, "Installed");
- p = DefineType(MAPOBJECT, ENUMERATED, "MAPOBJECT", PrintENUMERATED);
+ p = DefineType(MAPOBJECT, ENUMERATED, "MAPOBJECT", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "Modifier");
DefineEValue(p, 1L, "Keyboard");
DefineEValue(p, 2L, "Pointer");
- p = DefineType(BYTEMODE, ENUMERATED, "BYTEMODE", PrintENUMERATED);
+ p = DefineType(BYTEMODE, ENUMERATED, "BYTEMODE", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0x42L, "MSB first");
DefineEValue(p, 0x6CL, "LSB first");
- p = DefineType(BYTEORDER, ENUMERATED, "BYTEORDER", PrintENUMERATED);
+ p = DefineType(BYTEORDER, ENUMERATED, "BYTEORDER", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "LSB first");
DefineEValue(p, 1L, "MSB first");
- p = DefineType(COLORCLASS, ENUMERATED, "COLORCLASS", PrintENUMERATED);
+ p = DefineType(COLORCLASS, ENUMERATED, "COLORCLASS", (PrintProcType) PrintENUMERATED);
DefineEValue(p, 0L, "StaticGray");
DefineEValue(p, 1L, "GrayScale");
DefineEValue(p, 2L, "StaticColor");
@@ -853,11 +879,12 @@ InitEnumeratedTypes()
/* */
/* ************************************************************ */
+static void
InitSetTypes()
{
TYPE p;
- p = DefineType(SETofEVENT, SET, "SETofEVENT", PrintSET);
+ p = DefineType(SETofEVENT, SET, "SETofEVENT", (PrintProcType) PrintSET);
DefineEValue(p, 0x00000001L, "KeyPress");
DefineEValue(p, 0x00000002L, "KeyRelease");
DefineEValue(p, 0x00000004L, "ButtonPress");
@@ -884,7 +911,7 @@ InitSetTypes()
DefineEValue(p, 0x00800000L, "ColormapChange");
DefineEValue(p, 0x01000000L, "OwnerGrabButton");
- p = DefineType(SETofPOINTEREVENT, SET, "SETofPOINTEREVENT", PrintSET);
+ p = DefineType(SETofPOINTEREVENT, SET, "SETofPOINTEREVENT", (PrintProcType) PrintSET);
DefineEValue(p, 0x00000004L, "ButtonPress");
DefineEValue(p, 0x00000008L, "ButtonRelease");
DefineEValue(p, 0x00000010L, "EnterWindow");
@@ -899,7 +926,7 @@ InitSetTypes()
DefineEValue(p, 0x00002000L, "ButtonMotion");
DefineEValue(p, 0x00004000L, "KeymapState");
- p = DefineType(SETofDEVICEEVENT, SET, "SETofDEVICEEVENT", PrintSET);
+ p = DefineType(SETofDEVICEEVENT, SET, "SETofDEVICEEVENT", (PrintProcType) PrintSET);
DefineEValue(p, 0x00000001L, "KeyPress");
DefineEValue(p, 0x00000002L, "KeyRelease");
DefineEValue(p, 0x00000004L, "ButtonPress");
@@ -912,7 +939,7 @@ InitSetTypes()
DefineEValue(p, 0x00001000L, "Button5Motion");
DefineEValue(p, 0x00002000L, "ButtonMotion");
- p = DefineType(SETofKEYBUTMASK, SET, "SETofKEYBUTMASK", PrintSET);
+ p = DefineType(SETofKEYBUTMASK, SET, "SETofKEYBUTMASK", (PrintProcType) PrintSET);
DefineEValue(p, 0x0001L, "Shift");
DefineEValue(p, 0x0002L, "Lock");
DefineEValue(p, 0x0004L, "Control");
@@ -927,7 +954,7 @@ InitSetTypes()
DefineEValue(p, 0x0800L, "Button4");
DefineEValue(p, 0x1000L, "Button5");
- p = DefineType(SETofKEYMASK, SET, "SETofKEYMASK", PrintSET);
+ p = DefineType(SETofKEYMASK, SET, "SETofKEYMASK", (PrintProcType) PrintSET);
DefineEValue(p, 0x0001L, "Shift");
DefineEValue(p, 0x0002L, "Lock");
DefineEValue(p, 0x0004L, "Control");
@@ -938,12 +965,12 @@ InitSetTypes()
DefineEValue(p, 0x0080L, "Mod5");
DefineEValue(p, 0x8000L, "AnyModifier");
- p = DefineType(COLORMASK, SET, "COLORMASK", PrintSET);
+ p = DefineType(COLORMASK, SET, "COLORMASK", (PrintProcType) PrintSET);
DefineEValue(p, 0x01L, "do-red");
DefineEValue(p, 0x02L, "do-green");
DefineEValue(p, 0x04L, "do-blue");
- p = DefineType(SCREENFOCUS, SET, "SCREENFOCUS", PrintSET);
+ p = DefineType(SCREENFOCUS, SET, "SCREENFOCUS", (PrintProcType) PrintSET);
DefineEValue(p, 0x01L, "focus");
DefineEValue(p, 0x02L, "same-screen");
}
@@ -956,13 +983,16 @@ InitSetTypes()
/* Print Routines for builtin record types */
+static int
PrintCHAR2B(buf)
unsigned char *buf;
{
PrintField(buf, 0, 1, CARD8, "byte1");
PrintField(buf, 1, 1, CARD8, "byte2");
+ return(2);
}
+static int
PrintPOINT(buf)
unsigned char *buf;
{
@@ -971,6 +1001,7 @@ PrintPOINT(buf)
return(4);
}
+static int
PrintRECTANGLE(buf)
unsigned char *buf;
{
@@ -981,6 +1012,7 @@ PrintRECTANGLE(buf)
return(8);
}
+static int
PrintARC(buf)
unsigned char *buf;
{
@@ -993,6 +1025,7 @@ PrintARC(buf)
return(12);
}
+static int
PrintHOST(buf)
unsigned char *buf;
{
@@ -1000,10 +1033,39 @@ PrintHOST(buf)
PrintField(buf, 0, 1, HOSTFAMILY, "family");
PrintField(buf, 2, 2, DVALUE2(n), "length of address");
n = IShort(&buf[2]);
- (void)PrintList(&buf[4], (long)n, BYTE, "address");
+ switch (buf[0]) {
+ case 0:
+ {
+ struct in_addr ia;
+ char *addr;
+ memcpy(&ia, &buf[4], sizeof(ia)); /* Need to get alignment right */
+ addr = inet_ntoa(ia);
+ PrintString8((unsigned char *)addr, strlen(addr), "address");
+ break;
+ }
+#ifdef IPv6
+ case 6:
+ {
+ struct in6_addr i6a;
+ char addr[INET6_ADDRSTRLEN];
+ memcpy(&i6a, &buf[4], sizeof(i6a)); /* Need to get alignment right */
+ inet_ntop(AF_INET6, &i6a, addr, sizeof(addr));
+ PrintString8((unsigned char *) addr, strlen(addr), "address");
+ break;
+ }
+#endif
+
+ case 254:
+ PrintString8(&buf[4], n, "address");
+ break;
+
+ default:
+ PrintList(&buf[4], (long)n, BYTE, "address");
+ }
return(pad((long)(4 + n)));
}
+static int
PrintTIMECOORD(buf)
unsigned char *buf;
{
@@ -1013,6 +1075,7 @@ PrintTIMECOORD(buf)
return(8);
}
+static int
PrintFONTPROP(buf)
unsigned char *buf;
{
@@ -1021,6 +1084,7 @@ PrintFONTPROP(buf)
return(8);
}
+static int
PrintCHARINFO(buf)
unsigned char *buf;
{
@@ -1033,6 +1097,7 @@ PrintCHARINFO(buf)
return(12);
}
+static int
PrintSEGMENT(buf)
unsigned char *buf;
{
@@ -1043,6 +1108,7 @@ PrintSEGMENT(buf)
return(8);
}
+static int
PrintCOLORITEM(buf)
unsigned char *buf;
{
@@ -1054,6 +1120,7 @@ PrintCOLORITEM(buf)
return(12);
}
+static int
PrintRGB(buf)
unsigned char *buf;
{
@@ -1063,6 +1130,7 @@ PrintRGB(buf)
return(8);
}
+static int
PrintFORMAT(buf)
unsigned char *buf;
{
@@ -1072,6 +1140,7 @@ PrintFORMAT(buf)
return(8);
}
+static int
PrintSCREEN(buf)
unsigned char *buf;
{
@@ -1099,6 +1168,7 @@ PrintSCREEN(buf)
return(40 + m);
}
+static int
PrintDEPTH(buf)
unsigned char *buf;
{
@@ -1112,6 +1182,7 @@ PrintDEPTH(buf)
return(8 + m);
}
+static int
PrintVISUALTYPE(buf)
unsigned char *buf;
{
@@ -1127,6 +1198,7 @@ PrintVISUALTYPE(buf)
/* ************************************************************ */
+static void
InitRecordTypes()
{
(void) DefineType(CHAR2B, RECORD, "CHAR2B", PrintCHAR2B);
@@ -1153,11 +1225,12 @@ InitRecordTypes()
/* */
/* ************************************************************ */
+static void
InitValuesTypes()
{
TYPE p;
- p = DefineType(WINDOW_BITMASK, SET, "WINDOW_BITMASK", PrintSET);
+ p = DefineType(WINDOW_BITMASK, SET, "WINDOW_BITMASK", (PrintProcType) PrintSET);
DefineValues(p, 0x00000001L, 4, PIXMAPNPR, "background-pixmap");
DefineValues(p, 0x00000002L, 4, CARD32, "background-pixel");
@@ -1175,7 +1248,7 @@ InitValuesTypes()
DefineValues(p, 0x00002000L, 4, COLORMAPC, "colormap");
DefineValues(p, 0x00004000L, 4, CURSOR, "cursor");
- p = DefineType(CONFIGURE_BITMASK, SET, "CONFIGURE_BITMASK", PrintSET);
+ p = DefineType(CONFIGURE_BITMASK, SET, "CONFIGURE_BITMASK", (PrintProcType) PrintSET);
DefineValues(p, 0x0001L, 2, INT16, "x");
DefineValues(p, 0x0002L, 2, INT16, "y");
DefineValues(p, 0x0004L, 2, CARD16, "width");
@@ -1184,7 +1257,7 @@ InitValuesTypes()
DefineValues(p, 0x0020L, 4, WINDOW, "sibling");
DefineValues(p, 0x0040L, 1, STACKMODE, "stack-mode");
- p = DefineType(GC_BITMASK, SET, "GC_BITMASK", PrintSET);
+ p = DefineType(GC_BITMASK, SET, "GC_BITMASK", (PrintProcType) PrintSET);
DefineValues(p, 0x00000001L, 1, GCFUNC, "function");
DefineValues(p, 0x00000002L, 4, CARD32, "plane-mask");
DefineValues(p, 0x00000004L, 4, CARD32, "foreground");
@@ -1209,7 +1282,7 @@ InitValuesTypes()
DefineValues(p, 0x00200000L, 1, CARD8, "dashes");
DefineValues(p, 0x00400000L, 1, ARCMODE, "arc-mode");
- p = DefineType(KEYBOARD_BITMASK, SET, "KEYBOARD_BITMASK", PrintSET);
+ p = DefineType(KEYBOARD_BITMASK, SET, "KEYBOARD_BITMASK", (PrintProcType) PrintSET);
DefineValues(p, 0x0001L, 1, INT8, "key-click-percent");
DefineValues(p, 0x0002L, 1, INT8, "bell-percent");
DefineValues(p, 0x0004L, 2, INT16, "bell-pitch");
diff --git a/x11.h b/x11.h
index 91c8d19..b733e79 100644
--- a/x11.h
+++ b/x11.h
@@ -23,8 +23,37 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* *
+ * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
* ************************************************************ */
+#ifndef XSCOPE_X11_H
+#define XSCOPE_X11_H
/* Some field contents are constants, not just types */
@@ -238,53 +267,6 @@ extern char ScopeEnabled;
/* */
/* ************************************************************ */
-/* declaration of the existance of print routines for the basic types */
-
-extern int PrintINT8();
-extern int PrintINT16();
-extern int PrintINT32();
-extern int PrintCARD8();
-extern int PrintCARD16();
-extern int PrintCARD32();
-extern int PrintBYTE();
-extern int PrintCHAR8();
-extern int PrintSTRING16();
-extern int PrintTEXTITEM8();
-extern int PrintTEXTITEM16();
-extern int PrintSTR();
-extern int PrintWINDOW();
-extern int PrintWINDOWD();
-extern int PrintWINDOWNR();
-extern int PrintPIXMAP();
-extern int PrintPIXMAPNPR();
-extern int PrintPIXMAPC();
-extern int PrintCURSOR();
-extern int PrintFONT();
-extern int PrintGCONTEXT();
-extern int PrintCOLORMAP();
-extern int PrintCOLORMAPC();
-extern int PrintDRAWABLE();
-extern int PrintFONTABLE();
-extern int PrintATOM();
-extern int PrintATOMT();
-extern int PrintVISUALID();
-extern int PrintVISUALIDC();
-extern int PrintTIMESTAMP();
-extern int PrintRESOURCEID();
-extern int PrintKEYSYM();
-extern int PrintKEYCODE();
-extern int PrintKEYCODEA();
-extern int PrintBUTTON();
-extern int PrintBUTTONA();
-extern int PrintEVENTFORM();
-extern int PrintENUMERATED();
-extern int PrintSET();
-
-/* ************************************************************ */
-/* */
-/* */
-/* ************************************************************ */
-
/* Type Definition Table
Each item in the X11 Protocol has a type. There are about 120
@@ -314,12 +296,14 @@ struct ValueListEntry
long Value;
};
+typedef int (*PrintProcType) (unsigned char *);
+
struct TypeDef
{
char *Name;
short Type /* BUILTIN, ENUMERATED, SET, or RECORD */ ;
struct ValueListEntry *ValueList;
- int (*PrintProc)();
+ PrintProcType PrintProc;
};
typedef struct TypeDef *TYPE;
@@ -331,6 +315,53 @@ extern struct TypeDef TD[MaxTypes];
/* */
/* ************************************************************ */
+/* declaration of the existance of print routines for the basic types */
+
+extern int PrintINT8(unsigned char *buf);
+extern int PrintINT16(unsigned char *buf);
+extern int PrintINT32(unsigned char *buf);
+extern int PrintCARD8(unsigned char *buf);
+extern int PrintCARD16(unsigned char *buf);
+extern int PrintCARD32(unsigned char *buf);
+extern int PrintBYTE(unsigned char *buf);
+extern int PrintCHAR8(unsigned char *buf);
+extern int PrintSTRING16(unsigned char *buf);
+extern int PrintTEXTITEM8(unsigned char *buf);
+extern int PrintTEXTITEM16(unsigned char *buf);
+extern int PrintSTR(unsigned char *buf);
+extern int PrintWINDOW(unsigned char *buf);
+extern int PrintWINDOWD(unsigned char *buf);
+extern int PrintWINDOWNR(unsigned char *buf);
+extern int PrintPIXMAP(unsigned char *buf);
+extern int PrintPIXMAPNPR(unsigned char *buf);
+extern int PrintPIXMAPC(unsigned char *buf);
+extern int PrintCURSOR(unsigned char *buf);
+extern int PrintFONT(unsigned char *buf);
+extern int PrintGCONTEXT(unsigned char *buf);
+extern int PrintCOLORMAP(unsigned char *buf);
+extern int PrintCOLORMAPC(unsigned char *buf);
+extern int PrintDRAWABLE(unsigned char *buf);
+extern int PrintFONTABLE(unsigned char *buf);
+extern int PrintATOM(unsigned char *buf);
+extern int PrintATOMT(unsigned char *buf);
+extern int PrintVISUALID(unsigned char *buf);
+extern int PrintVISUALIDC(unsigned char *buf);
+extern int PrintTIMESTAMP(unsigned char *buf);
+extern int PrintRESOURCEID(unsigned char *buf);
+extern int PrintKEYSYM(unsigned char *buf);
+extern int PrintKEYCODE(unsigned char *buf);
+extern int PrintKEYCODEA(unsigned char *buf);
+extern int PrintBUTTON(unsigned char *buf);
+extern int PrintBUTTONA(unsigned char *buf);
+extern int PrintEVENTFORM(unsigned char *buf);
+extern int PrintENUMERATED(unsigned char *buf, short length, struct ValueListEntry *ValueList);
+extern int PrintSET(unsigned char *buf, short length, struct ValueListEntry *ValueList);
+
+/* ************************************************************ */
+/* */
+/* */
+/* ************************************************************ */
+
/* Reply Buffer: Pseudo-buffer used to provide the opcode for the
request to which this is a reply: Set by DecodeReply
and used in the PrintField of the Reply procedure */
@@ -498,15 +529,14 @@ extern PrintValueRec ();
extern unsigned long ILong();
extern unsigned short IShort();
-extern unsigned short IChar2B();
extern unsigned short IByte();
extern Boolean IBool();
extern PrintString8(), PrintTString8 ();
extern PrintString16(), PrintTString16 ();
-extern PrintListSTR();
extern long PrintList();
+extern long PrintListSTR();
extern long pad();
extern char *REQUESTHEADER, *EVENTHEADER, *ERRORHEADER, *REPLYHEADER;
@@ -534,3 +564,5 @@ extern char *REQUESTHEADER, *EVENTHEADER, *ERRORHEADER, *REPLYHEADER;
#define GC_dash_offset 0x00100000L
#define GC_dashes 0x00200000L
#define GC_arc_mode 0x00400000L
+
+#endif /* XSCOPE_X11_H */
diff --git a/xscope.man b/xscope.man
index 91a194b..50f9b34 100644
--- a/xscope.man
+++ b/xscope.man
@@ -1,163 +1,107 @@
-.TH XSCOPE 1 "8 Aug 1991" "X Version 11"
+.TH XSCOPE 1 "8 Sept 1988" "X Version 11"
.SH NAME
-xscope - X Window System Protocol Monitor
+xscope - X Window Protocol Viewer
.SH SYNOPSIS
.B xscope
-[ options ] ...
+[ option ] ...
.SH DESCRIPTION
-.I xscope
-is a program that monitors connections between an X server and a client.
-\fIxscope\fP prints to stdout the contents of each request, reply, error,
-or event that is communicated between the server and client.
-This information can be useful in debugging and performance tuning
-of X servers and clients.
+.I Xscope
+sits in-between an X11 client and an X11 server and prints the contents
+of each request, reply, error, or event that is communicated between them.
+This information can be useful in debugging and performance
+tuning of X11 servers and clients.
.PP
-\fIxscope\fP attaches to the X server as if it were a client.
-By adjusting the host and/or display number, the client can be made to
-attach to \fIxscope\fP instead of the X server.
+To operate, \fIxscope\fP must know the host, port, and display to use
+to connect to the X11 server. In addition, it must know the port on
+which it should listen for X11 clients. Two cases are common:
.PP
- server <-----> xscope <-----> client
-.PP
-All bytes from the server are sent to \fIxscope\fP which sends them on to
-the client.
-All bytes from the client are sent to \fIxscope\fP which passes them on
-to the server.
-\fIxscope\fP is transparent to both the server and the client.
-.SH OPTIONS
-.PP
-.TP 10
-.B \-d<display>
-Defines the display number.
-The display number is added to the input and output port to give the
-actual ports which are used by \fIxscope\fP.
+.TP 5
+(1) The X11 server is on the same host as \fIxscope\fP.
+In this case, the input port for \fIxscope\fP should be selected as an
+X11 server on a different display, and the client DISPLAY argument
+adjusted to select \fIxscope\fP . For example, if the X11 server is
+on port 6000, display 1, then \fIxscope\fP can use port 6002 as its
+input port. The client can use display 1 for direct access to X11 or
+display 2 for access to \fIxscope\fP.
.PP
-.TP 10
-.B \-h<host>
-Determines the host that \fIxscope\fP will use to find the server.
+.TP 5
+(2) The X11 server is on a different host than \fIxscope\fP.
+In this case the same input and output ports can be used, and the host
+component of the DISPLAY is used to select \fIxscope\fP or X11.
+.SH ARGUMENTS
.PP
.TP 10
.B \-i<input-port>
Specify the port that \fIxscope\fP will use to take requests from clients
-(defaults is 1).
+(defaults to 1).
For X11, this port is automatically biased by 6000.
.PP
.TP 10
.B \-o<output-port>
-Determines the port that \fIxscope\fP will use to connect to the server
-(defaults is 0).
+Determines the port that
+\fIxscope\fP will use to connect to X11 (defaults to 0).
For X11, this port is automatically biased by 6000.
.PP
.TP 10
+.B \-h<host>
+Determines the host that \fIxscope\fP will use to find its X11 server.
+.PP
+.TP 10
+.B \-d<display>
+Defines the display number. The display number is added to the input
+and output port to give the actual ports which are used by \fIxscope\fP.
+.PP
+.TP 10
.B \-q
Quiet output mode. Gives only the names of requests, replies, errors, and
events, but does not indicate contents.
.PP
.TP 10
.B \-v<print-level>
-Determines the level of verbosity which \fIxscope\fP will provide.
-The print-level can be 0 (same as quiet mode), 1, 2, 3, 4.
-The larger numbers give more and more output.
-For example, a successful setup returns a string which is the name of the
-vendor of the X server.
+Determines the level of printing which \fIxscope\fP will provide. The
+print-level can be 0 (same as quiet mode), 1, 2, 3, 4. The larger
+numbers give more and more output. For example, a successful setup
+returns a string which is the name of the vendor of the X11 server.
At level 1, the explicit field giving the length of the string is
-suppressed since it can be inferred from the string.
-At level 2 and above the length is explicitly printed.
-.SH OPERATION
-When running with \fIxscope\fP, three processes are involved, potentially
-all on different machines:
-.PP
-.TP 5
-\fIX server\fP
-The X server will run on machine (or host) "A", display "B".
-("A" is a machine name; "B" is a display number).
-.PP
-.TP 5
-\fIxscope\fP
-\fIxscope\fP must be told where the X server is (what machine and
-what display), and, in addition, the \fIport-number\fP on which to listen
-for X clients.
-The options for \fIxscope\fP are "-h<Xserver-host>" and "-d<display-number>".
-In this example, -hA and -dB.
-Typically the \fIdisplay-number\fP is not given.
-\fIxscope\fP will not try to connect to the server until the client
-connects to \fIxscope\fP.
-.PP
-.TP 5
-\fIX client\fP
-The client should connect to \fIxscope\fP rather than to the server.
-To avoid changing the code for the client, \fIxscope\fP listens on
-the same port as the server for connecting clients.
-If the server and \fIxscope\fP are on different machines, this works well.
-However, if the server and \fIxscope\fP are on the same machine, this
-creates a port conflict.
-To resolve this conflict, \fIxscope\fP can be given a different
-input or output port number, as necessary, to avoid the port that
-the server is listening to.
-The client must connect to this offset port number.
-The input port for \fIxscope\fP is set by \fI-i<port-number>\fP;
-the output port is set by \fI-o<port-number>.\fP
-The default input port is 1; the default output port is 0.
-These ports are offset by the X11 base (6000) and the display number.
-The client attaches to \fIxscope\fP by changing its display number by the
-port offset.
+suppressed since it can be inferred from the string. At level 2 and
+above the length is explicitly printed.
.SH EXAMPLES
.LP
-.B "xscope -hbagel -i0"
-.PP
-The X server would run on "bagel", display 0 (the default).
-\fIxscope\fP and the client would both be on "cleo".
-The client program would connect to "X" on "cleo:0",
-and would be attached to \fIxscope\fP, which would then attach to
-the server on "bagel:0".
-.PP
- server (bagel:0) <-----> xscope -hbagel -i0 <-----> client -d cleo:0
-.LP
-.B "xscope -i1"
-.PP
-Here is a case where all three processes would run on "cleo".
-\fIxscope\fP would listen on port 6001 (which is display 1 for X11).
-The client would attach to the server on "cleo:1", and \fIxscope\fP
-would connect through to the server on "cleo:0".
-.PP
- server (cleo:0) <-----> xscope -i1 <-----> client -d cleo:1
-.LP
-.B "xscope -hcleo -d0 -o0 -i1 -v4"
+xscope -v4 -hcleo -d0 -o0 -i1
.PP
-This example is similar to the previous one, and would have \fIxscope\fP
-communicate with an X server on host ``cleo'', display 0.
-\fIxscope\fP itself would be available on the current host as display 1
-(display of 0 plus the 1 of -i1).
-Verbose level 4.
-.PP
- server (cleo:0) <-----> xscope -hcleo -d0 -o0 -i1 -v4 <-----> client -d cleo:1
+This command would have xscope communicate with an X11 server on host
+``cleo'', display 0; xscope itself would be available on the current
+host as display 1 (display of 0 plus the 1 of -i1). Verbose level 4.
.LP
-.B "xscope -d1 -o1 -i3 -q"
-.PP
-The X server for the current host, display 2 (1 for -d1 plus 1 for -o1)
-would be used by \fIxscope\fP, which would run as display 4 (1 for -d1 plus
-3 for -i3).
-Quiet mode (verbose level 0).
-.PP
- server (unix:1) <-----> xscope -d1 -o1 -i3 -q <-----> client -d unix:4
-.SH LIMITATIONS
-The X Version 11 and PEX Version 5 Protocols are the only protocols recognized.
-.PP
-The command line arguments for specifying the real X server should be
-changed to be more consistent with the style since X11R3.
-.PP
-The Imakefile may be incorrect.
-.PP
-The builtin atoms have been wired in directly.
-A better solution is to pick them up from a header file.
+xscope -q -d1 -o1 -o3
.PP
-There is no code yet to interpret typed commands from the keyboard.
-It would be possible for a command language at the keyboard to create
-artificial characters to be sent to the server or the client as if they were
-generated by the opposite side, or to dynamically alter requests or replies.
+The X11 server for the current host, display 2 (1 for -d1 plus 1 for -o1)
+would be used by xscope which would run as display 4 (1 for -d1 plus 3 for
+-o3). Quite mode (verbose level 0).
.SH SEE ALSO
-X(1), X11 and PEX Protocol documents
+X(1), X11 Protocol document (doc/Protocol/X11.protocol)
.SH AUTHOR
.PP
James L. Peterson (MCC)
.PP
-Copyright 1988, MCC
+Copyright (C) 1988 MCC
+.PP
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation, and that the name of MCC not be used in
+advertising or publicity pertaining to distribution of the software without
+specific, written prior permission. MCC makes no
+representations about the suitability of this software for any purpose. It
+is provided "as is" without express or implied warranty.
+.PP
+MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL MCC BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+.SH BUGS
+Code has only been tested on Sun3's.