v02i050: monitor X11 Server/Client communications, Patch1
Mike Wexler
mikew at wyse.wyse.com
Fri Dec 23 03:48:05 AEST 1988
Submitted-by: peterson at sw.MCC.COM (James Peterson)
Posting-number: Volume 2, Issue 50
Archive-name: xmonitor/patch1
These patches fix a number of minor problems:
1. Lint problems.
2. Portability problems with DONTLINGER and errno.h
3. Setting up to handle byte-swapping.
4. SendEvent generated events.
diff -c distribution/patchlevel.h ./patchlevel.h
*** distribution/patchlevel.h Thu Dec 22 09:42:09 1988
--- ./patchlevel.h Thu Dec 22 09:42:18 1988
***************
*** 1,2 ****
! #define PATCHLEVEL 0
--- 1,2 ----
! #define PATCHLEVEL 1
diff -c distribution/common.c ./common.c
*** distribution/common.c Tue Dec 20 15:46:33 1988
--- ./common.c Tue Dec 20 17:37:11 1988
***************
*** 112,124 ****
SetSignalHandling()
{
enterprocedure("SetSignalHandling");
! signal(SIGURG, SignalURG);
! signal(SIGPIPE, SignalPIPE);
! signal(SIGINT, SignalINT);
! signal(SIGQUIT, SignalQUIT);
! signal(SIGTERM, SignalTERM);
! signal(SIGTSTP, SignalTSTP);
! signal(SIGCONT, SignalCONT);
}
--- 112,124 ----
SetSignalHandling()
{
enterprocedure("SetSignalHandling");
! (void)signal(SIGURG, SignalURG);
! (void)signal(SIGPIPE, SignalPIPE);
! (void)signal(SIGINT, SignalINT);
! (void)signal(SIGQUIT, SignalQUIT);
! (void)signal(SIGTERM, SignalTERM);
! (void)signal(SIGTSTP, SignalTSTP);
! (void)signal(SIGCONT, SignalCONT);
}
***************
*** 148,153 ****
--- 148,156 ----
{
FD ConnectionSocket;
struct sockaddr_in sin;
+ #ifndef SO_DONTLINGER
+ struct linger linger;
+ #endif SO_DONTLINGER
enterprocedure("SetUpConnectionSocket");
***************
*** 160,166 ****
--- 163,175 ----
}
(void)setsockopt(ConnectionSocket, SOL_SOCKET, SO_REUSEADDR, (char *)NULL, 0);
(void)setsockopt(ConnectionSocket, SOL_SOCKET, SO_USELOOPBACK, (char *)NULL, 0);
+ #ifdef SO_DONTLINGER
(void)setsockopt(ConnectionSocket, SOL_SOCKET, SO_DONTLINGER, (char *)NULL, 0);
+ #else SO_DONTLINGER
+ linger.l_onoff = 0;
+ linger.l_linger = 0;
+ (void)setsockopt(ConnectionSocket, SOL_SOCKET, SO_LINGER, (char *)&linger, sizeof linger);
+ #endif SO_DONTLINGER
/* define the name and port to be used with the connection socket */
bzero((char *)&sin, sizeof(sin));
***************
*** 176,182 ****
(void) gethostname(MyHostName, sizeof(MyHostName));
ScopeHost = (char *) Malloc((long)strlen(MyHostName));
! strcpy(ScopeHost, MyHostName);
hp = gethostbyname(MyHostName);
if (hp == NULL)
panic("No address for our host");
--- 185,191 ----
(void) gethostname(MyHostName, sizeof(MyHostName));
ScopeHost = (char *) Malloc((long)strlen(MyHostName));
! (void)strcpy(ScopeHost, MyHostName);
hp = gethostbyname(MyHostName);
if (hp == NULL)
panic("No address for our host");
***************
*** 208,215 ****
};
/* a few more parameter settings */
! ioctl(ConnectionSocket, FIOCLEX, 0);
! ioctl(ConnectionSocket, FIONBIO, &ON);
debug(4,(stderr, "Listening on FD %d\n", ConnectionSocket));
UsingFD(ConnectionSocket, NewConnection);
--- 217,224 ----
};
/* a few more parameter settings */
! (void)ioctl(ConnectionSocket, FIOCLEX, 0);
! (void)ioctl(ConnectionSocket, FIONBIO, &ON);
debug(4,(stderr, "Listening on FD %d\n", ConnectionSocket));
UsingFD(ConnectionSocket, NewConnection);
diff -c distribution/decode11.c ./decode11.c
*** distribution/decode11.c Tue Dec 20 15:46:34 1988
--- ./decode11.c Tue Dec 20 17:37:14 1988
***************
*** 911,916 ****
--- 911,922 ----
SetIndentLevel(PRINTSERVER);
if (Verbose > 3)
DumpItem("Event", fd, buf, n);
+ /* high-order bit means SendEvent generated */
+ if (Event & 0x80)
+ {
+ debug(8,(stderr, "SendEvent generated event 0x%x\n", Event));
+ Event = Event & 0x7F;
+ }
if (Event < 2 || Event > 34)
warn("Extended Event code");
else switch (Event)
diff -c distribution/fd.c ./fd.c
*** distribution/fd.c Tue Dec 20 15:46:40 1988
--- ./fd.c Tue Dec 20 17:37:17 1988
***************
*** 32,37 ****
--- 32,42 ----
enterprocedure("InitializeFD");
/* get the number of file descriptors the system will let us use */
MaxFD = getdtablesize();
+ if (MaxFD > StaticMaxFD)
+ {
+ fprintf(stderr, "Recompile with larger StaticMaxFD value %d\n", MaxFD);
+ MaxFD = StaticMaxFD;
+ }
/* allocate space for a File Descriptor (FD) Table */
FDD = (struct FDDescriptor *)
***************
*** 42,48 ****
{
/* 0, 1, 2 are special (stdin, stdout, stderr) */
if (i > 2)
! close(i);
FDD[i].Busy = false;
}
--- 47,53 ----
{
/* 0, 1, 2 are special (stdin, stdout, stderr) */
if (i > 2)
! (void)close(i);
FDD[i].Busy = false;
}
***************
*** 111,117 ****
{
enterprocedure("EOFonFD");
debug(128,(stderr, "EOF on %d\n", fd));
! close(fd);
NotUsingFD(fd);
}
--- 116,122 ----
{
enterprocedure("EOFonFD");
debug(128,(stderr, "EOF on %d\n", fd));
! (void)close(fd);
NotUsingFD(fd);
}
***************
*** 122,128 ****
/* */
/* ************************************************************ */
! #include <errno.h> /* for EINTR, EADDRINUSE, ... */
extern int errno;
--- 127,134 ----
/* */
/* ************************************************************ */
! #include <sys/time.h> /* for struct timeval * */
! #include <errno.h> /* for EINTR, EADDRINUSE, ... */
extern int errno;
***************
*** 142,148 ****
xfds = rfds;
debug(128,(stderr, "select %d, rfds = 0%o\n", HighestFD + 1, rfds));
! nfds = select(HighestFD + 1, &rfds, &wfds, &xfds, NULL);
debug(128,(stderr, "select nfds = 0%o, rfds = 0%o, 0%o, xfds 0%o\n",
nfds, rfds, wfds, xfds));
--- 148,154 ----
xfds = rfds;
debug(128,(stderr, "select %d, rfds = 0%o\n", HighestFD + 1, rfds));
! nfds = select(HighestFD + 1, &rfds, &wfds, &xfds, (struct timeval *)NULL);
debug(128,(stderr, "select nfds = 0%o, rfds = 0%o, 0%o, xfds 0%o\n",
nfds, rfds, wfds, xfds));
diff -c distribution/print11.c ./print11.c
*** distribution/print11.c Tue Dec 20 15:47:08 1988
--- ./print11.c Tue Dec 20 17:37:28 1988
***************
*** 63,70 ****
n = IShort(&buf[6]);
printfield(buf, 8, 2, DVALUE2(d), "length of data");
d = IShort(&buf[8]);
! PrintString8(&buf[12], n, "authorization-protocol-name");
! PrintString8(&buf[pad((long)(12 + n))], d, "authorization-protocol-data");
}
PrintSetUpReply(buf)
--- 63,70 ----
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");
}
PrintSetUpReply(buf)
***************
*** 91,97 ****
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], n, "reason");
}
PrintSuccessfulSetUpReply(buf)
--- 91,97 ----
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");
}
PrintSuccessfulSetUpReply(buf)
***************
*** 123,131 ****
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], 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");
}
--- 123,131 ----
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");
}
***************
*** 816,829 ****
ClientMessageEvent(buf)
unsigned char *buf;
{
PrintField(buf, 0, 1, EVENT, EVENTHEADER) /* ClientMessage */ ;
if (Verbose < 1)
return;
PrintField(buf, 1, 1, CARD8, "format");
printfield(buf, 2, 2, CARD16, "sequence number");
PrintField(buf, 4, 4, WINDOW, "window");
PrintField(buf, 8, 4, ATOM, "type");
! PrintBytes(&buf[12], (long)20,"data");
}
MappingNotifyEvent(buf)
--- 816,841 ----
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");
}
MappingNotifyEvent(buf)
***************
*** 1130,1136 ****
PrintField(buf, 12, 4, WINDOW, "parent");
printfield(buf, 16, 2, DVALUE2(n), "number of children");
n = IShort(&buf[16]);
! PrintList(&buf[32], (long)n, WINDOW, "children");
}
InternAtom(buf)
--- 1142,1148 ----
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");
}
InternAtom(buf)
***************
*** 1148,1154 ****
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], n, "name");
}
InternAtomReply(buf)
--- 1160,1166 ----
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");
}
InternAtomReply(buf)
***************
*** 1187,1193 ****
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], n, "name");
}
ChangeProperty(buf)
--- 1199,1205 ----
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");
}
ChangeProperty(buf)
***************
*** 1194,1200 ****
unsigned char *buf;
{
long n;
! short unit;
long type;
/* Request ChangeProperty is opcode 18 */
--- 1206,1212 ----
unsigned char *buf;
{
long n;
! short format;
long type;
/* Request ChangeProperty is opcode 18 */
***************
*** 1211,1223 ****
PrintField(buf, 12, 4, ATOM, "type");
type = ILong(&buf[12]);
PrintField(buf, 16, 1, CARD8, "format");
! 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 * unit, "data");
else
! PrintBytes(&buf[24], n * unit, "data");
}
DeleteProperty(buf)
--- 1223,1239 ----
PrintField(buf, 12, 4, ATOM, "type");
type = ILong(&buf[12]);
PrintField(buf, 16, 1, CARD8, "format");
! format = IByte(&buf[16]);
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");
else
! PrintBytes(&buf[24], n * format/8, "data");
}
DeleteProperty(buf)
***************
*** 1258,1264 ****
unsigned char *buf;
{
long n;
! short unit;
long type;
PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* GetProperty */ ;
--- 1274,1280 ----
unsigned char *buf;
{
long n;
! short format;
long type;
PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* GetProperty */ ;
***************
*** 1265,1271 ****
if (Verbose < 1)
return;
PrintField(buf, 1, 1, CARD8, "format");
! 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");
--- 1281,1287 ----
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, DVALUE4((n + p) / 4), "reply length");
PrintField(buf, 8, 4, ATOM, "type");
***************
*** 1274,1282 ****
printfield(buf, 16, 4, CARD32, "length of value");
n = ILong(&buf[16]);
if (type == 31 /* string */)
! PrintString8(&buf[32], n * unit, "value");
else
! PrintBytes(&buf[32], n * unit, "value");
}
ListProperties(buf)
--- 1290,1302 ----
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");
else
! PrintBytes(&buf[32], n * format/8, "value");
}
ListProperties(buf)
***************
*** 1304,1310 ****
printfield(buf, 4, 4, DVALUE4(n), "reply length");
printfield(buf, 8, 2, DVALUE2(n), "number of atoms");
n = IShort(&buf[8]);
! PrintList(&buf[32], (long)n, ATOM, "atoms");
}
SetSelectionOwner(buf)
--- 1324,1330 ----
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");
}
SetSelectionOwner(buf)
***************
*** 1661,1667 ****
printfield(buf, 4, 4, DVALUE4(2*n), "reply length");
printfield(buf, 8, 4, DVALUE4(n), "number of events");
n = ILong(&buf[8]);
! PrintList(&buf[32], n, TIMECOORD, "events");
}
TranslateCoordinates(buf)
--- 1681,1687 ----
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");
}
TranslateCoordinates(buf)
***************
*** 1785,1790 ****
--- 1805,1811 ----
unsigned char *buf;
{
short n;
+
/* Request OpenFont is opcode 45 */
PrintField(buf, 0, 1, REQUEST, REQUESTHEADER) /* OpenFont */ ;
if (Verbose < 1)
***************
*** 1796,1802 ****
PrintField(buf, 4, 4, FONT, "font-id");
printfield(buf, 8, 2, DVALUE2(n), "length of name");
n = IShort(&buf[8]);
! PrintString8(&buf[12], n, "name");
}
CloseFont(buf)
--- 1817,1823 ----
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");
}
CloseFont(buf)
***************
*** 1855,1861 ****
printfield(buf, 56, 4, DVALUE4(m), "number of CHARINFOs");
m = ILong(&buf[56]);
k = PrintList(&buf[60], (long)n, FONTPROP, "properties");
! PrintList(&buf[60 + k], (long)m, CHARINFO, "char-infos");
}
QueryTextExtents(buf)
--- 1876,1882 ----
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");
}
QueryTextExtents(buf)
***************
*** 1876,1882 ****
if (IBool(&buf[1]))
n -= 1;
PrintField(buf, 4, 4, FONTABLE, "font");
! PrintString16(&buf[8], n, "string");
}
QueryTextExtentsReply(buf)
--- 1897,1903 ----
if (IBool(&buf[1]))
n -= 1;
PrintField(buf, 4, 4, FONTABLE, "font");
! PrintString16(&buf[8], (long)n, "string");
}
QueryTextExtentsReply(buf)
***************
*** 1901,1906 ****
--- 1922,1928 ----
unsigned char *buf;
{
short n;
+
/* Request ListFonts is opcode 49 */
PrintField(buf, 0, 1, REQUEST, REQUESTHEADER) /* ListFonts */ ;
if (Verbose < 1)
***************
*** 1912,1918 ****
PrintField(buf, 4, 2, CARD16, "max-names");
printfield(buf, 6, 2, DVALUE2(n), "length of pattern");
n = IShort(&buf[6]);
! PrintString8(&buf[8], n, "pattern");
}
ListFontsReply(buf)
--- 1934,1940 ----
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");
}
ListFontsReply(buf)
***************
*** 1934,1939 ****
--- 1956,1962 ----
unsigned char *buf;
{
short n;
+
/* Request ListFontsWithInfo is opcode 50 */
PrintField(buf, 0, 1, REQUEST, REQUESTHEADER) /* ListFontsWithInfo */ ;
if (Verbose < 1)
***************
*** 1945,1951 ****
PrintField(buf, 4, 2, CARD16, "max-names");
printfield(buf, 6, 2, DVALUE2(n), "length of pattern");
n = IShort(&buf[6]);
! PrintString8(&buf[8], n, "pattern");
}
ListFontsWithInfoReply(buf)
--- 1968,1974 ----
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");
}
ListFontsWithInfoReply(buf)
***************
*** 1988,1995 ****
PrintField(buf, 52, 2, INT16, "font-ascent");
PrintField(buf, 54, 2, INT16, "font-descent");
PrintField(buf, 56, 4, CARD32, "replies-hint");
! PrintList(&buf[60], (long)m, FONTPROP, "properties");
! PrintString8(&buf[60 + 8 * m], n, "name");
}
ListFontsWithInfoReply2(buf)
--- 2011,2018 ----
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");
}
ListFontsWithInfoReply2(buf)
***************
*** 2162,2168 ****
PrintField(buf, 4, 4, GCONTEXT, "gc");
PrintField(buf, 8, 2, INT16, "clip-x-origin");
PrintField(buf, 10, 2, INT16, "clip-y-origin");
! PrintList(&buf[12], (long)n, RECTANGLE, "rectangles");
}
FreeGC(buf)
--- 2185,2191 ----
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");
}
FreeGC(buf)
***************
*** 2259,2265 ****
n = (IShort(&buf[2]) - 3);
PrintField(buf, 4, 4, DRAWABLE, "drawable");
PrintField(buf, 8, 4, GCONTEXT, "gc");
! PrintList(&buf[12], (long)n, POINT, "points");
}
PolyLine(buf)
--- 2282,2288 ----
n = (IShort(&buf[2]) - 3);
PrintField(buf, 4, 4, DRAWABLE, "drawable");
PrintField(buf, 8, 4, GCONTEXT, "gc");
! (void)PrintList(&buf[12], (long)n, POINT, "points");
}
PolyLine(buf)
***************
*** 2278,2284 ****
n = (IShort(&buf[2]) - 3);
PrintField(buf, 4, 4, DRAWABLE, "drawable");
PrintField(buf, 8, 4, GCONTEXT, "gc");
! PrintList(&buf[12], (long)n, POINT, "points");
}
PolySegment(buf)
--- 2301,2307 ----
n = (IShort(&buf[2]) - 3);
PrintField(buf, 4, 4, DRAWABLE, "drawable");
PrintField(buf, 8, 4, GCONTEXT, "gc");
! (void)PrintList(&buf[12], (long)n, POINT, "points");
}
PolySegment(buf)
***************
*** 2296,2302 ****
n = (IShort(&buf[2]) - 3) / 2;
PrintField(buf, 4, 4, DRAWABLE, "drawable");
PrintField(buf, 8, 4, GCONTEXT, "gc");
! PrintList(&buf[12], (long)n, SEGMENT, "segments");
}
PolyRectangle(buf)
--- 2319,2325 ----
n = (IShort(&buf[2]) - 3) / 2;
PrintField(buf, 4, 4, DRAWABLE, "drawable");
PrintField(buf, 8, 4, GCONTEXT, "gc");
! (void)PrintList(&buf[12], (long)n, SEGMENT, "segments");
}
PolyRectangle(buf)
***************
*** 2314,2320 ****
n = (IShort(&buf[2]) - 3) / 2;
PrintField(buf, 4, 4, DRAWABLE, "drawable");
PrintField(buf, 8, 4, GCONTEXT, "gc");
! PrintList(&buf[12], (long)n, RECTANGLE, "rectangles");
}
PolyArc(buf)
--- 2337,2343 ----
n = (IShort(&buf[2]) - 3) / 2;
PrintField(buf, 4, 4, DRAWABLE, "drawable");
PrintField(buf, 8, 4, GCONTEXT, "gc");
! (void)PrintList(&buf[12], (long)n, RECTANGLE, "rectangles");
}
PolyArc(buf)
***************
*** 2332,2338 ****
n = (IShort(&buf[2]) - 3) / 3;
PrintField(buf, 4, 4, DRAWABLE, "drawable");
PrintField(buf, 8, 4, GCONTEXT, "gc");
! PrintList(&buf[12], (long)n, ARC, "arcs");
}
FillPoly(buf)
--- 2355,2361 ----
n = (IShort(&buf[2]) - 3) / 3;
PrintField(buf, 4, 4, DRAWABLE, "drawable");
PrintField(buf, 8, 4, GCONTEXT, "gc");
! (void)PrintList(&buf[12], (long)n, ARC, "arcs");
}
FillPoly(buf)
***************
*** 2352,2358 ****
PrintField(buf, 8, 4, GCONTEXT, "gc");
PrintField(buf, 12, 1, POLYSHAPE, "shape");
PrintField(buf, 13, 1, COORMODE, "coordinate-mode");
! PrintList(&buf[16], (long)n, POINT, "points");
}
PolyFillRectangle(buf)
--- 2375,2381 ----
PrintField(buf, 8, 4, GCONTEXT, "gc");
PrintField(buf, 12, 1, POLYSHAPE, "shape");
PrintField(buf, 13, 1, COORMODE, "coordinate-mode");
! (void)PrintList(&buf[16], (long)n, POINT, "points");
}
PolyFillRectangle(buf)
***************
*** 2370,2376 ****
n = (IShort(&buf[2]) - 3) / 2;
PrintField(buf, 4, 4, DRAWABLE, "drawable");
PrintField(buf, 8, 4, GCONTEXT, "gc");
! PrintList(&buf[12], (long)n, RECTANGLE, "rectangles");
}
PolyFillArc(buf)
--- 2393,2399 ----
n = (IShort(&buf[2]) - 3) / 2;
PrintField(buf, 4, 4, DRAWABLE, "drawable");
PrintField(buf, 8, 4, GCONTEXT, "gc");
! (void)PrintList(&buf[12], (long)n, RECTANGLE, "rectangles");
}
PolyFillArc(buf)
***************
*** 2388,2394 ****
n = (IShort(&buf[2]) - 3) / 3;
PrintField(buf, 4, 4, DRAWABLE, "drawable");
PrintField(buf, 8, 4, GCONTEXT, "gc");
! PrintList(&buf[12], (long)n, ARC, "arcs");
}
PutImage(buf)
--- 2411,2417 ----
n = (IShort(&buf[2]) - 3) / 3;
PrintField(buf, 4, 4, DRAWABLE, "drawable");
PrintField(buf, 8, 4, GCONTEXT, "gc");
! (void)PrintList(&buf[12], (long)n, ARC, "arcs");
}
PutImage(buf)
***************
*** 2529,2535 ****
PrintField(buf, 8, 4, GCONTEXT, "gc");
PrintField(buf, 12, 2, INT16, "x");
PrintField(buf, 14, 2, INT16, "y");
! PrintString8(&buf[16], n, "string");
}
ImageText16(buf)
--- 2552,2558 ----
PrintField(buf, 8, 4, GCONTEXT, "gc");
PrintField(buf, 12, 2, INT16, "x");
PrintField(buf, 14, 2, INT16, "y");
! PrintString8(&buf[16], (long)n, "string");
}
ImageText16(buf)
***************
*** 2550,2556 ****
PrintField(buf, 8, 4, GCONTEXT, "gc");
PrintField(buf, 12, 2, INT16, "x");
PrintField(buf, 14, 2, INT16, "y");
! PrintString16(&buf[16], n, "string");
}
CreateColormap(buf)
--- 2573,2579 ----
PrintField(buf, 8, 4, GCONTEXT, "gc");
PrintField(buf, 12, 2, INT16, "x");
PrintField(buf, 14, 2, INT16, "y");
! PrintString16(&buf[16], (long)n, "string");
}
CreateColormap(buf)
***************
*** 2652,2658 ****
printfield(buf, 4, 4, DVALUE4(n), "reply length");
printfield(buf, 8, 2, DVALUE2(n), "number of cmaps");
n = IShort(&buf[8]);
! PrintList(&buf[32], (long)n, COLORMAP, "cmaps");
}
AllocColor(buf)
--- 2675,2681 ----
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");
}
AllocColor(buf)
***************
*** 2701,2707 ****
PrintField(buf, 4, 4, COLORMAP, "cmap");
printfield(buf, 8, 2, DVALUE2(n), "length of name");
n = IShort(&buf[8]);
! PrintString8(&buf[12], n, "name");
}
AllocNamedColorReply(buf)
--- 2724,2730 ----
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");
}
AllocNamedColorReply(buf)
***************
*** 2754,2760 ****
printfield(buf, 10, 2, DVALUE2(m), "number of masks");
m = IShort(&buf[10]);
k = PrintList(&buf[32], (long)n, CARD32, "pixels");
! PrintList(&buf[32 + k], (long)m, CARD32, "masks");
}
AllocColorPlanes(buf)
--- 2777,2783 ----
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");
}
AllocColorPlanes(buf)
***************
*** 2790,2796 ****
PrintField(buf, 12, 4, CARD32, "red-mask");
PrintField(buf, 16, 4, CARD32, "green-mask");
PrintField(buf, 20, 4, CARD32, "blue-mask");
! PrintList(&buf[32], (long)n, CARD32, "pixels");
}
FreeColors(buf)
--- 2813,2819 ----
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");
}
FreeColors(buf)
***************
*** 2809,2815 ****
n = IShort(&buf[2]) - 3;
PrintField(buf, 4, 4, COLORMAP, "cmap");
PrintField(buf, 8, 4, CARD32, "plane-mask");
! PrintList(&buf[12], (long)n, CARD32, "pixels");
}
StoreColors(buf)
--- 2832,2838 ----
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");
}
StoreColors(buf)
***************
*** 2826,2832 ****
printfield(buf, 2, 2, DVALUE2(2 + 3*n), "request length");
n = (IShort(&buf[2]) - 2) / 3;
PrintField(buf, 4, 4, COLORMAP, "cmap");
! PrintList(&buf[8], (long)n, COLORITEM, "items");
}
StoreNamedColor(buf)
--- 2849,2855 ----
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");
}
StoreNamedColor(buf)
***************
*** 2846,2852 ****
PrintField(buf, 8, 4, CARD32, "pixel");
printfield(buf, 12, 2, DVALUE2(n), "length of name");
n = IShort(&buf[12]);
! PrintString8(&buf[16], n, "name");
}
QueryColors(buf)
--- 2869,2875 ----
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");
}
QueryColors(buf)
***************
*** 2863,2869 ****
printfield(buf, 2, 2, DVALUE2(2 + n), "request length");
n = IShort(&buf[2]) - 2;
PrintField(buf, 4, 4, COLORMAP, "cmap");
! PrintList(&buf[8], (long)n, CARD32, "pixels");
}
QueryColorsReply(buf)
--- 2886,2892 ----
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");
}
QueryColorsReply(buf)
***************
*** 2877,2883 ****
printfield(buf, 4, 4, DVALUE4(2*n), "reply length");
printfield(buf, 8, 2, DVALUE2(n), "number of colors");
n = IShort(&buf[8]);
! PrintList(&buf[32], (long)n, RGB, "colors");
}
LookupColor(buf)
--- 2900,2906 ----
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");
}
LookupColor(buf)
***************
*** 2895,2901 ****
PrintField(buf, 4, 4, COLORMAP, "cmap");
printfield(buf, 8, 2, DVALUE2(n), "length of name");
n = IShort(&buf[8]);
! PrintString8(&buf[12], n, "name");
}
LookupColorReply(buf)
--- 2918,2924 ----
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");
}
LookupColorReply(buf)
***************
*** 3039,3045 ****
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], n, "name");
}
QueryExtensionReply(buf)
--- 3062,3068 ----
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");
}
QueryExtensionReply(buf)
***************
*** 3102,3108 ****
PrintField(buf, 4, 1, KEYCODE, "first-keycode");
PrintField(buf, 5, 1, DVALUE1(m), "keysyms-per-keycode");
m = IByte(&buf[5]);
! PrintList(&buf[8], (long)(n * m), KEYSYM, "keysyms");
}
GetKeyboardMapping(buf)
--- 3125,3131 ----
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");
}
GetKeyboardMapping(buf)
***************
*** 3131,3137 ****
printfield(buf, 2, 2, CARD16, "sequence number");
printfield(buf, 4, 4, DVALUE4(n*m), "reply length");
n = ILong(&buf[4]);
! PrintList(&buf[32], n, KEYSYM, "keysyms");
}
ChangeKeyboardControl(buf)
--- 3154,3160 ----
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");
}
ChangeKeyboardControl(buf)
***************
*** 3325,3331 ****
printfield(buf, 4, 4, DVALUE4(n / 4), "reply length");
printfield(buf, 8, 2, CARD16, "number of hosts");
n = IShort(&buf[8]);
! PrintList(&buf[32], (long)n, HOST, "hosts");
}
SetAccessControl(buf)
--- 3348,3354 ----
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");
}
SetAccessControl(buf)
***************
*** 3386,3392 ****
printfield(buf, 8, 2, DVALUE2(n), "number of properties");
n = IShort(&buf[8]);
PrintField(buf, 10, 2, INT16, "delta");
! PrintList(&buf[12], (long)n, ATOM, "properties");
}
ForceScreenSaver(buf)
--- 3409,3415 ----
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");
}
ForceScreenSaver(buf)
***************
*** 3517,3523 ****
n = IByte(&buf[1]);
printfield(buf, 2, 2, CARD16, "sequence number");
printfield(buf, 4, 4, DVALUE4(2*n), "reply length");
! PrintList(&buf[32], (long)n, KEYCODE, "keycodes");
}
NoOperation(buf)
--- 3540,3546 ----
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");
}
NoOperation(buf)
diff -c distribution/prtype.c ./prtype.c
*** distribution/prtype.c Tue Dec 20 15:46:36 1988
--- ./prtype.c Tue Dec 20 17:37:31 1988
***************
*** 63,69 ****
else
{
/* very large number -- print as 0xffff - 4 digit hex */
! sprintf(pr, "0x%04x", c);
}
return(pr);
}
--- 63,69 ----
else
{
/* very large number -- print as 0xffff - 4 digit hex */
! (void)sprintf(pr, "0x%04x", c);
}
return(pr);
}
***************
*** 226,233 ****
PrintSTRING16(buf)
unsigned char *buf;
{
! /* print a CHAR16 -- 16-bit character */
! unsigned short n = IShort (buf);
fprintf(stdout, "%s", printrep(n));
return(1);
}
--- 226,233 ----
PrintSTRING16(buf)
unsigned char *buf;
{
! /* print a CHAR2B -- 16-bit character which is never byte-swapped */
! unsigned short n = IChar2B (buf);
fprintf(stdout, "%s", printrep(n));
return(1);
}
***************
*** 269,275 ****
else if (n == 1)
fprintf(stdout, "InputFocus");
else
! PrintWINDOW(buf);
}
PrintWINDOWNR(buf)
--- 269,275 ----
else if (n == 1)
fprintf(stdout, "InputFocus");
else
! (void)PrintWINDOW(buf);
}
PrintWINDOWNR(buf)
***************
*** 282,288 ****
else if (n == 1)
fprintf(stdout, "PointerRoot");
else
! PrintWINDOW(buf);
}
--- 282,288 ----
else if (n == 1)
fprintf(stdout, "PointerRoot");
else
! (void)PrintWINDOW(buf);
}
***************
*** 375,381 ****
if (n == 0)
fprintf(stdout, "CopyFromParent");
else
! PrintCOLORMAP(buf);
}
--- 375,381 ----
if (n == 0)
fprintf(stdout, "CopyFromParent");
else
! (void)PrintCOLORMAP(buf);
}
***************
*** 441,447 ****
if (n == 0)
fprintf(stdout, "AnyPropertyType");
else
! PrintATOM(buf);
}
--- 441,447 ----
if (n == 0)
fprintf(stdout, "AnyPropertyType");
else
! (void)PrintATOM(buf);
}
***************
*** 518,524 ****
if (n == 0)
fprintf(stdout, "AnyKey");
else
! PrintKEYCODE(buf);
}
--- 518,524 ----
if (n == 0)
fprintf(stdout, "AnyKey");
else
! (void)PrintKEYCODE(buf);
}
***************
*** 672,678 ****
break;
}
fprintf(stdout, "\n");
! fflush(stdout);
}
/* ************************************************************ */
--- 672,678 ----
break;
}
fprintf(stdout, "\n");
! (void)fflush(stdout);
}
/* ************************************************************ */
***************
*** 734,740 ****
/* print a list of STRs. Similar to PrintList
They start at <buf>. There are <number> things in the list */
! long PrintListSTR(buf, number, name)
unsigned char *buf;
long number;
char *name;
--- 734,740 ----
/* print a list of STRs. Similar to PrintList
They start at <buf>. There are <number> things in the list */
! PrintListSTR(buf, number, name)
unsigned char *buf;
long number;
char *name;
***************
*** 744,754 ****
long sum;
if (number == 0)
! return(0);
fprintf(stdout, "%s%20s: (%d)\n", Leader, name, number);
if (Verbose < 2)
! return(0);
ModifyIndentLevel(1);
sum = 0;
--- 744,754 ----
long sum;
if (number == 0)
! return;
fprintf(stdout, "%s%20s: (%d)\n", Leader, name, number);
if (Verbose < 2)
! return;
ModifyIndentLevel(1);
sum = 0;
***************
*** 762,768 ****
}
ModifyIndentLevel(-1);
! return(sum);
}
--- 762,768 ----
}
ModifyIndentLevel(-1);
! return;
}
***************
*** 782,788 ****
short column;
if (number == 0)
! return(0);
fprintf(stdout, "%s%20s: ", Leader, name);
column = SizeofLeader() + 25;
--- 782,788 ----
short column;
if (number == 0)
! return;
fprintf(stdout, "%s%20s: ", Leader, name);
column = SizeofLeader() + 25;
***************
*** 800,806 ****
}
fprintf(stdout, "\n");
! return(number);
}
--- 800,806 ----
}
fprintf(stdout, "\n");
! return;
}
***************
*** 814,858 ****
PrintString8(buf, number, name)
unsigned char buf[];
! short number;
char *name;
{
! short i;
if (number == 0)
! 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 CHAR16 -- 16-bit characters */
PrintString16(buf, number, name)
unsigned char buf[];
! short number;
char *name;
{
! short i;
unsigned short c;
if (number == 0)
! return(0);
fprintf(stdout, "%s%20s: \"", Leader, name);
for (i = 0; i < number; i += 2)
{
! c = IShort(&buf[i]);
fprintf(stdout, "%s", printrep(c));
}
fprintf(stdout, "\"\n");
-
- return(number);
}
/* ************************************************************ */
--- 814,854 ----
PrintString8(buf, number, name)
unsigned char buf[];
! long number;
char *name;
{
! long i;
if (number == 0)
! return;
fprintf(stdout, "%s%20s: \"", Leader, name);
for (i = 0; i < number; i++)
fprintf(stdout, "%s", printrep(buf[i]));
fprintf(stdout, "\"\n");
}
! /* print a String of CHAR2B -- 16-bit characters */
PrintString16(buf, number, name)
unsigned char buf[];
! long number;
char *name;
{
! long i;
unsigned short c;
if (number == 0)
! return;
fprintf(stdout, "%s%20s: \"", Leader, name);
for (i = 0; i < number; i += 2)
{
! c = IChar2B(&buf[i]);
fprintf(stdout, "%s", printrep(c));
}
fprintf(stdout, "\"\n");
}
/* ************************************************************ */
***************
*** 929,935 ****
if (n != 255)
{
PrintField(buf, 1, 1, INT8, "delta");
! PrintString8(&buf[2], n, "text item 8 string");
buf += n + 2;
length -= n + 2;
}
--- 925,931 ----
if (n != 255)
{
PrintField(buf, 1, 1, INT8, "delta");
! PrintString8(&buf[2], (long)n, "text item 8 string");
buf += n + 2;
length -= n + 2;
}
***************
*** 956,962 ****
if (n != 255)
{
PrintField(buf, 1, 1, INT8, "delta");
! PrintString16(&buf[2], n, "text item 16 string");
buf += n + 2;
length -= n + 2;
}
--- 952,958 ----
if (n != 255)
{
PrintField(buf, 1, 1, INT8, "delta");
! PrintString16(&buf[2], (long)n, "text item 16 string");
buf += n + 2;
length -= n + 2;
}
***************
*** 989,995 ****
for (i = 0; i < n; i++)
{
/* get the hex representations */
! sprintf(h, "%02x",(0xff & buf[i]));
/* check if these characters will fit on this line */
if ((column + strlen(h) + 1) > MAXline)
--- 985,991 ----
for (i = 0; i < n; i++)
{
/* get the hex representations */
! (void)sprintf(h, "%02x",(0xff & buf[i]));
/* check if these characters will fit on this line */
if ((column + strlen(h) + 1) > MAXline)
diff -c distribution/scope.c ./scope.c
*** distribution/scope.c Tue Dec 20 15:46:28 1988
--- ./scope.c Tue Dec 20 17:37:34 1988
***************
*** 9,14 ****
--- 9,22 ----
#include "scope.h"
+ #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;
/* ********************************************** */
/* */
***************
*** 68,74 ****
}
! char *OfficialName() /* forward type declaration */;
ScanArgs(argc, argv)
int argc;
--- 76,82 ----
}
! char *OfficialName(); /* forward type declaration */
ScanArgs(argc, argv)
int argc;
***************
*** 134,140 ****
case 'h':
if (++*argv != NULL && **argv != '\0')
! strcpy(ServerHostName, OfficialName(*argv));
debug(1,(stderr, "ServerHostName=%s\n", ServerHostName));
break;
--- 142,148 ----
case 'h':
if (++*argv != NULL && **argv != '\0')
! (void)strcpy(ServerHostName, OfficialName(*argv));
debug(1,(stderr, "ServerHostName=%s\n", ServerHostName));
break;
***************
*** 262,268 ****
}
else if (server >= 0)
{
! close(server);
NotUsingFD(server);
}
}
--- 270,276 ----
}
else if (server >= 0)
{
! (void)close(server);
NotUsingFD(server);
}
}
***************
*** 275,283 ****
StopClientConnection(ServerHalf(fd));
StopServerConnection(ClientHalf(fd));
! close(fd);
NotUsingFD(fd);
! close(FDPair(fd));
NotUsingFD(FDPair(fd));
}
--- 283,291 ----
StopClientConnection(ServerHalf(fd));
StopServerConnection(ClientHalf(fd));
! (void)close(fd);
NotUsingFD(fd);
! (void)close(FDPair(fd));
NotUsingFD(FDPair(fd));
}
***************
*** 312,318 ****
if (ClientNumber <= 1)
return("");
! sprintf(name, " %d", FDinfo[fd].ClientNumber);
return(name);
}
--- 320,326 ----
if (ClientNumber <= 1)
return("");
! (void)sprintf(name, " %d", FDinfo[fd].ClientNumber);
return(name);
}
***************
*** 458,472 ****
/* */
/* ************************************************************ */
- #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 */ ;
NewConnection(fd)
--- 466,471 ----
***************
*** 506,513 ****
}
UsingFD(ClientFD, DataFromClient);
! ioctl(ClientFD, FIOCLEX, 0);
! ioctl(ClientFD, FIONBIO, &ON);
StartClientConnection(ClientFD);
return(ClientFD);
}
--- 505,512 ----
}
UsingFD(ClientFD, DataFromClient);
! (void)ioctl(ClientFD, FIOCLEX, 0);
! (void)ioctl(ClientFD, FIONBIO, &ON);
StartClientConnection(ClientFD);
return(ClientFD);
}
***************
*** 527,532 ****
--- 526,534 ----
FD ServerFD;
struct sockaddr_in sin;
struct hostent *hp;
+ #ifndef SO_DONTLINGER
+ struct linger linger;
+ #endif SO_DONTLINGER
enterprocedure("ConnectToServer");
***************
*** 541,547 ****
--- 543,555 ----
}
(void) setsockopt(ServerFD, SOL_SOCKET, SO_REUSEADDR, (char *) NULL, 0);
(void) setsockopt(ServerFD, SOL_SOCKET, SO_USELOOPBACK,(char *) NULL, 0);
+ #ifdef SO_DONTLINGER
(void) setsockopt(ServerFD, SOL_SOCKET, SO_DONTLINGER, (char *) NULL, 0);
+ #else SO_DONTLINGER
+ linger.l_onoff = 0;
+ linger.l_linger = 0;
+ (void) setsockopt(ServerFD, SOL_SOCKET, SO_LINGER, (char *)&linger, sizeof linger);
+ #endif SO_DONTLINGER
/* determine the host machine for this process */
if (ServerHostName[0] == '\0')
***************
*** 564,570 ****
&& strcmp(ServerHostName, ScopeHost) == 0)
{
char error_message[100];
! sprintf(error_message, "Trying to attach to myself: %s,%d\n",
ServerHostName, sin.sin_port);
panic(error_message);
}
--- 572,578 ----
&& strcmp(ServerHostName, ScopeHost) == 0)
{
char error_message[100];
! (void)sprintf(error_message, "Trying to attach to myself: %s,%d\n",
ServerHostName, sin.sin_port);
panic(error_message);
}
***************
*** 583,589 ****
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");
--- 591,597 ----
case ECONNREFUSED:
/* experience says this is because there is no Server
to connect to */
! (void)close(ServerFD);
debug(1,(stderr, "No Server\n"));
if (report)
warn("Can't open connection to Server");
***************
*** 590,596 ****
return(-1);
default:
! close(ServerFD);
panic("Can't open connection to Server");
}
}
--- 598,604 ----
return(-1);
default:
! (void)close(ServerFD);
panic("Can't open connection to Server");
}
}
diff -c distribution/server.c ./server.c
*** distribution/server.c Tue Dec 20 15:46:41 1988
--- ./server.c Tue Dec 20 17:37:39 1988
***************
*** 56,62 ****
long sec /* seconds */ ;
long hsec /* hundredths of a second */ ;
! gettimeofday(&tp, (struct timezone *)NULL);
if (ZeroTime1 == -1 || (tp.tv_sec - lastsec) >= 1000)
{
ZeroTime1 = tp.tv_sec;
--- 56,62 ----
long sec /* seconds */ ;
long hsec /* hundredths of a second */ ;
! (void)gettimeofday(&tp, (struct timezone *)NULL);
if (ZeroTime1 == -1 || (tp.tv_sec - lastsec) >= 1000)
{
ZeroTime1 = tp.tv_sec;
***************
*** 93,98 ****
--- 93,99 ----
unsigned long ILong (buf)
unsigned char buf[];
{
+ /* check for byte-swapping */
return((((((buf[0] << 8) | buf[1]) << 8) | buf[2]) << 8) | buf[3]);
}
***************
*** 99,107 ****
--- 100,116 ----
unsigned short IShort (buf)
unsigned char buf[];
{
+ /* check for byte-swapping */
return((buf[0] << 8) | buf[1]);
}
+ unsigned short IChar2B (buf)
+ unsigned char buf[];
+ {
+ /* CHAR2B is like an IShort, but not byte-swapped */
+ return((buf[0] << 8) | buf[1]);
+ }
+
unsigned short IByte (buf)
unsigned char buf[];
{
***************
*** 137,146 ****
/* not enough room so far; malloc more space and copy */
long SizeofNewBytes = (CS[fd].NumberofSavedBytes + n + 1);
unsigned char *NewBytes = (unsigned char *)Malloc (SizeofNewBytes);
! 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;
}
--- 146,158 ----
/* 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);
! }
CS[fd].SavedBytes = NewBytes;
CS[fd].SizeofSavedBytes = SizeofNewBytes;
}
diff -c distribution/table11.c ./table11.c
*** distribution/table11.c Tue Dec 20 15:46:22 1988
--- ./table11.c Tue Dec 20 17:37:43 1988
***************
*** 412,418 ****
--- 412,452 ----
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);
DefineEValue(p, 0L, "Forget");
DefineEValue(p, 1L, "NorthWest");
***************
*** 833,839 ****
PrintField(buf, 0, 1, HOSTFAMILY, "family");
PrintField(buf, 2, 2, DVALUE2(n), "length of address");
n = IShort(&buf[2]);
! PrintList(&buf[4], (long)n, BYTE, "address");
return(pad((long)(4 + n)));
}
--- 867,873 ----
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");
return(pad((long)(4 + n)));
}
diff -c distribution/x11.h ./x11.h
*** distribution/x11.h Tue Dec 20 15:46:42 1988
--- ./x11.h Tue Dec 20 17:37:45 1988
***************
*** 422,430 ****
extern unsigned long ILong();
extern unsigned short IShort();
extern unsigned short IByte();
extern Boolean IBool();
extern long PrintList();
- extern long PrintListSTR();
extern long pad();
--- 422,434 ----
extern unsigned long ILong();
extern unsigned short IShort();
+ extern unsigned short IChar2B();
extern unsigned short IByte();
extern Boolean IBool();
+ extern PrintString8();
+ extern PrintString16();
+ extern PrintListSTR();
+
extern long PrintList();
extern long pad();
--
Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330
Moderator of comp.sources.x
More information about the Comp.sources.x
mailing list