1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
|
/*
* Copyright 1990, 1991 by the Massachusetts Institute of Technology and
* UniSoft Group Limited.
*
* 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 names of MIT and UniSoft not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. MIT and UniSoft
* make no representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
* $XConsortium$
*/
/*
* ***************************************************************************
* Copyright 1988 by Sequent Computer Systems, Inc., Portland, Oregon *
* *
* *
* 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 appears in all copies and that *
* both that copyright notice and this permission notice appear in *
* supporting documentation, and that the name of Sequent not be used *
* in advertising or publicity pertaining to distribution or use of the *
* software without specific, written prior permission. *
* *
* SEQUENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING *
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL *
* SEQUENT 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. *
* ***************************************************************************
*/
/*
* THIS IS AN OS DEPENDENT FILE! It should work on 4.2BSD derived
* systems. VMS and System V should plan to have their own version.
* More portable functionality is available in XlibWithXTest.c if your
* Xlib has the post R5 release patches to move auth/conn handling from
* XOpenDis.c into XConDis.c and hence returned by _XConnectDisplay().
* If not you can portably do client-native only testing with XlibOpaque.c
* which uses XOpenDisplay to make the connection and then ConnectionNumber()
* to get the fd. This route is also appropriate if your Xlib has a different
* internal interface to the MIT release or else you don't have source.
* See the documentation of the build parameter XP_OPEN_DIS for more details.
*/
#include <stdio.h>
#include <string.h>
#include "XstlibInt.h"
#include "XstosInt.h"
#include "DataMove.h"
#include <fcntl.h>
#include <sys/file.h>
#include <sys/socket.h>
#ifdef UNIXCONN
#include <sys/un.h>
#define X_UNIX_PATH "/tmp/.X11-unix/X"
#endif /* UNIXCONN */
/* time_proc used to set timeout routines and on error in Xst_EINTR_Read */
static void (*time_proc)() = 0;
#define Xst_EINTR_Read(dpy, buffer, len) \
while (errno=0, *(char *)buffer=xFalse, 0 > Xst_Read (dpy, (char *) buffer, (long) len)) \
if (errno != EINTR) { \
if (time_proc) \
(*time_proc)(); \
else { \
Log_Msg ("read failed with errno = %d\n", errno); \
Delete(); \
} \
/*NOTREACHED*/ \
}
/*
* Attempts to connect to server, given display name. Returns file descriptor
* (network socket) or -1 if connection fails. The expanded display name
* of the form hostname:number.screen ("::" if DECnet) is returned in a result
* parameter. The screen number to use is also returned.
*/
int XstConnectDisplay (display_name, expanded_name, screen_num,
auth_proto, auth_length, auth_string, auth_strlen,
xlib_dpy)
char *display_name;
char *expanded_name; /* return */
int *screen_num; /* return */
char **auth_proto; /* return */
int *auth_length; /* return */
char **auth_string; /* return */
int *auth_strlen; /* return */
Display **xlib_dpy; /* return */
{
char displaybuf[256]; /* Display string buffer */
register char *display_ptr; /* Display string buffer pointer */
register char *numbuf_ptr; /* Server number buffer pointer */
char *screen_ptr; /* Pointer for locating screen num */
int display_num; /* Display number */
struct sockaddr_in inaddr; /* INET socket address. */
#ifdef UNIXCONN
struct sockaddr_un unaddr; /* UNIX socket address. */
#endif
struct sockaddr *addr; /* address to connect to */
struct hostent *host_ptr;
int addrlen; /* length of address */
extern char *getenv();
extern struct hostent *gethostbyname();
int fd; /* Network socket */
char numberbuf[16];
char *dot_ptr = NULL; /* Pointer to . before screen num */
#ifdef DNETCONN
int dnet = 0;
char objname[20];
extern int dnet_conn();
#endif
*auth_proto = "";
*auth_length = 0;
*auth_string = "";
*auth_strlen = 0;
*xlib_dpy = (Display *)NULL;
/*
* Find the ':' seperator and extract the hostname and the
* display number.
* NOTE - if DECnet is to be used, the display name is formatted
* as "host::number"
*/
(void) strncpy(displaybuf, display_name, sizeof(displaybuf));
if ((display_ptr = SearchString(displaybuf,':')) == (char *)NULL)
return (-1);
#ifdef DNETCONN
if (*(display_ptr + 1) == ':') {
dnet++;
*(display_ptr++) = '\0';
}
#endif
*(display_ptr++) = '\0';
/* displaybuf now contains only a null-terminated host name, and
* display_ptr points to the display number.
* If the display number is missing there is an error. */
if (*display_ptr == '\0') return(-1);
/*
* Build a string of the form <display-number>.<screen-number> in
* numberbuf, using ".0" as the default.
*/
screen_ptr = display_ptr;
numbuf_ptr = numberbuf;
while (*screen_ptr != '\0') {
if (*screen_ptr == '.') {
dot_ptr = numbuf_ptr;
*(screen_ptr++) = '\0';
*(numbuf_ptr++) = '.';
} else {
*(numbuf_ptr++) = *(screen_ptr++);
}
}
/*
* If the spec doesn't include a screen number, add ".0" (or "0" if
* only "." is present.)
*/
if (dot_ptr == NULL) {
dot_ptr = numbuf_ptr;
*(numbuf_ptr++) = '.';
*(numbuf_ptr++) = '0';
} else {
if (*(numbuf_ptr - 1) == '.')
*(numbuf_ptr++) = '0';
}
*numbuf_ptr = '\0';
/*
* Return the screen number in the result parameter
*/
*screen_num = atoi(dot_ptr + 1);
/*
* Convert the server number string to an integer.
*/
display_num = atoi(display_ptr);
/*
* If the display name is missing, use current host.
*/
if (displaybuf[0] == '\0')
#ifdef DNETCONN
if (dnet)
(void) strcpy (displaybuf, "0");
else
#endif
#ifdef UNIXCONN
; /* Do nothing if UNIX DOMAIN. Will be handled below. */
#else
(void) gethostname (displaybuf, sizeof(displaybuf));
#endif
#ifdef DNETCONN
if (dnet) {
/*
* build the target object name.
*/
sprintf(objname, "X%d", display_num);
/*
* Attempt to open the DECnet connection, return -1 if fails.
*/
if ((fd = dnet_conn(displaybuf,
objname, SOCK_STREAM, 0, 0, 0, 0)) < 0)
return(-1); /* errno set by dnet_conn. */
} else
#endif
{
#ifdef UNIXCONN
if ((displaybuf[0] == '\0') ||
(strcmp("unix", displaybuf) == 0)) {
/* Connect locally using Unix domain. */
unaddr.sun_family = AF_UNIX;
(void) strcpy(unaddr.sun_path, X_UNIX_PATH);
strcat(unaddr.sun_path, display_ptr);
addr = (struct sockaddr *) &unaddr;
addrlen = strlen(unaddr.sun_path) + 2;
/*
* Open the network connection.
*/
if ((fd = socket((int) addr->sa_family, SOCK_STREAM, 0)) < 0)
return(-1); /* errno set by system call. */
} else
#endif
{
/* Get the statistics on the specified host. */
if ((inaddr.sin_addr.s_addr = inet_addr(displaybuf)) == -1) {
if ((host_ptr = gethostbyname(displaybuf)) == NULL) {
/* No such host! */
errno = EINVAL;
return(-1);
}
/* Check the address type for an internet host. */
if (host_ptr->h_addrtype != AF_INET) {
/* Not an Internet host! */
errno = EPROTOTYPE;
return(-1);
}
/* Set up the socket data. */
inaddr.sin_family = host_ptr->h_addrtype;
bcopy((char *)host_ptr->h_addr,
(char *)&inaddr.sin_addr,
sizeof(inaddr.sin_addr));
} else {
inaddr.sin_family = AF_INET;
}
addr = (struct sockaddr *) &inaddr;
addrlen = sizeof (struct sockaddr_in);
inaddr.sin_port = display_num;
inaddr.sin_port += X_TCP_PORT;
inaddr.sin_port = htons(inaddr.sin_port);
/*
* Open the network connection.
*/
if ((fd = socket((int) addr->sa_family, SOCK_STREAM, 0)) < 0)
return(-1); /* errno set by system call. */
/* make sure to turn off TCP coalescence */
#ifdef TCP_NODELAY
{
int mi;
setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &mi, sizeof (int));
}
#endif
}
if (connect(fd, addr, addrlen) == -1) {
(void) close (fd);
return(-1); /* errno set by system call. */
}
#ifdef FIOSNBIO
{
int arg = 1;
ioctl (fd, FIOSNBIO, &arg);
}
#else
(void) fcntl (fd, F_SETFL, FNDELAY);
#endif /* FIOSNBIO */
}
/*
* Return the id if the connection succeeded. Rebuild the expanded
* spec and return it in the result parameter.
*/
display_ptr = displaybuf;
while (*(++display_ptr) != '\0')
;
*(display_ptr++) = ':';
#ifdef DNETCONN
if (dnet)
*(display_ptr++) = ':';
#endif
numbuf_ptr = numberbuf;
while (*numbuf_ptr != '\0')
*(display_ptr++) = *(numbuf_ptr++);
*display_ptr = '\0';
(void) strcpy(expanded_name, displaybuf);
return(fd);
}
/*
* Disconnect from server.
*/
int XstDisconnectDisplay (server)
int server;
{
(void) close(server);
}
#undef NULL
#define NULL ((char *) 0)
_XstWaitForReadable(dpy)
XstDisplay *dpy;
{
int r_mask[MSKCNT];
int result;
CLEARBITS(r_mask);
do {
BITSET(r_mask, dpy->fd);
result = select(dpy->fd + 1, r_mask, (int *) 0, (int *) 0, (struct timeval *)NULL);
if (result == -1 && errno != EINTR) {
XstIOError(dpy,"_XstWaitForReadable",1);
}
} while (result <= 0);
}
static unsigned int padlength[4] = {0, 3, 2, 1};
XstSendClientPrefix (dpy, client, auth_proto, auth_string, needswap)
XstDisplay *dpy;
xConnClientPrefix *client;
int needswap;
{
/*
* Authorization string stuff.... Must always transmit multiple of 4
* bytes.
*/
int auth_length, auth_strlen;
char pad[3];
char buffer[BUFSIZ], *bptr;
int bytes=0;
auth_length = client->nbytesAuthProto;
auth_strlen = client->nbytesAuthString;
bytes = (sizeof(xConnClientPrefix) +
auth_length + padlength[auth_length & 3] +
auth_strlen + padlength[auth_strlen & 3]);
/* bcopy(client, buffer, sizeof(xConnClientPrefix)); */
bptr = buffer;
BPRINTF1 ("OpenDisplay message:\n");
pack1(&bptr,client->byteOrder);
BPRINTF2 ("\tbyteOrder = 0x%x\n", (unsigned) client->byteOrder);
packpad(&bptr,sizeof(client->pad));
BPRINTF2 ("\tpad = %d\n", (int) *(bptr-1));
pack2(&bptr,(short)client->majorVersion,needswap);
BPRINTF2 ("\tmajorVersion = %d\n", client->majorVersion);
pack2(&bptr,(short)client->minorVersion,needswap);
BPRINTF2 ("\tminorVersion = %d\n", client->minorVersion);
pack2(&bptr,(short)client->nbytesAuthProto,needswap);
BPRINTF2 ("\tnbytesAuthProto = %d\n", client->nbytesAuthProto);
pack2(&bptr,(short)client->nbytesAuthString,needswap);
BPRINTF2 ("\tnbytesAuthString = %d\n", client->nbytesAuthString);
packpad(&bptr,sizeof(client->pad2));
BPRINTF2 ("\tpad2 = %d\n", (int) *(bptr-1));
/* bptr = buffer + sizeof(xConnClientPrefix); */
BPRINTF2 ("\tAuthProtoName = %d bytes\n", auth_length);
if (auth_length)
{
bcopy(auth_proto, bptr, auth_length);
bptr += auth_length;
if (padlength[auth_length & 3])
{
bcopy(pad, bptr, padlength[auth_length & 3]);
bptr += padlength[auth_length & 3];
BPRINTF2 ("\tAuthProtoName pad = %d bytes\n", padlength[auth_length & 3]);
}
}
BPRINTF2 ("\tAuthProtoData = %d bytes\n", auth_strlen);
if (auth_strlen)
{
bcopy(auth_string, bptr, auth_strlen);
bptr += auth_strlen;
if (padlength[auth_strlen & 3])
{
bcopy(pad, bptr, padlength[auth_strlen & 3]);
bptr += padlength[auth_strlen & 3];
BPRINTF2 ("\tAuthProtoData pad = %d bytes\n", padlength[auth_strlen & 3]);
}
}
BPRINTF2 ("\tTotal OpenDisplay message length = %d bytes\n", bytes);
BPRINTF2 ("\t\ton fd %d\n", dpy->fd);
BPRINTF2 ("\t\t%d bytes used of buffer\n", bptr - buffer);
(void) WriteToServer(dpy->fd, buffer, bytes);
return;
}
/*
* The Timeout function(s) must all exit -- we don't want to get
* into longjmp from out of signal (SIGALARM) handlers etc. So
* we have to use the test type and request type to work out
* what messages to put out and what exit code to give back to the TET.
*
* Behaviour is as follows:
*
* Request Type: OPEN_DISPLAY_REQUEST_TYPE || anything else
* Test Type: OPEN_DISPLAY | anything else || anything at all
* __________(bad byte order)| (0x42 or 0x6C) || (0x42 or 0x6C)
* Getting: \---------------+----------------++------------------
* | | ||
* SetupPrefix| PASS(Exit_OK)| FAIL(Abort) || Delete
* | | ||
* SetupData | Not Reached | FAIL(Abort) || Delete
* | (Delete) | ||
*
*/
#define PASS_action 1
#define FAIL_action 2
#define DELETE_action 3
static char *nothing = "No reply from server when trying to connect to %s\n";
static void
Timeout_Func(action)
int action;
{
char *server = Xst_server_node == NULL ? "Default Server" : Xst_server_node;
switch(action) {
case PASS_action:
Log_Trace("No prefix sent in response to bad byte order open request.");
Exit_OK ();
/*NOTREACHED*/
break;
case FAIL_action:
Log_Msg(nothing, server);
Abort ();
/*NOTREACHED*/
break;
case DELETE_action:
Log_Msg(nothing, server);
Delete ();
/*NOTREACHED*/
break;
default:
Log_Msg("INTERNAL TEST SUITE ERROR: bad action (%d) in Timeout_Func with server %s.", action, server);
Delete ();
/*NOTREACHED*/
break;
}
}
static void
Normal_Timeout_Func() {
Timeout_Func(DELETE_action);
}
static void
Good_Open_Timeout_Func() {
Timeout_Func(FAIL_action);
}
static void
Bad_Open_Timeout_Func() {
Timeout_Func(PASS_action);
}
GetConnSetupPrefix (client, prefixp, needswap)
int client;
xConnSetupPrefix * prefixp;
int needswap;
{
XstDisplay * dpy;
char buffer[OBUFSIZE];
char *bptr;
dpy = Get_Display(client);
if (Get_Req_Type(client) == OPEN_DISPLAY_REQUEST_TYPE) {
if (Get_Test_Type(client) == OPEN_DISPLAY)
time_proc = Bad_Open_Timeout_Func;
else
time_proc = Good_Open_Timeout_Func;
} else
time_proc = Normal_Timeout_Func;
Set_Timer (CONNECT_TIMER_ID, Xst_timeout_value, time_proc);
Xst_EINTR_Read (dpy, (char *) buffer, (long) sizeof (xConnSetupPrefix));
Stop_Timer (CONNECT_TIMER_ID);
BPRINTF1 ("Connection setup prefix:\n");
bptr = buffer;
prefixp -> success = unpack1 (&bptr);
BPRINTF2 ("\tsuccess = %s\n", boolname(prefixp->success));
prefixp -> lengthReason = unpack1 (&bptr);
BPRINTF2 ("\tlengthReason = %d\n", prefixp->lengthReason);
prefixp -> majorVersion = unpack2 (&bptr, needswap);
BPRINTF2 ("\tmajorVersion = %d\n", prefixp->majorVersion);
prefixp -> minorVersion = unpack2 (&bptr, needswap);
BPRINTF2 ("\tminorVersion = %d\n", prefixp->minorVersion);
prefixp -> length = unpack2 (&bptr, needswap);
BPRINTF2 ("\tlength = %d\n", prefixp->length);
}
/*
* GetConnSetupData - reads & byte swaps (as appropriate)
* the rest of the connection setup data
* (Note this is somewhat redundant with logic
* in XOpenDisplay - might merge later)
*/
GetConnSetupData (client, setupdp, len, needswap)
int client;
xConnSetup * setupdp;
int len;
int needswap;
{
XstDisplay * dpy;
char buffer[OBUFSIZE];
char *bptr;
char *sptr; /* pointer into setup data area */
int pad;
int i;
int d;
int s;
int v;
int f;
int ndepths;
int nvisuals;
dpy = Get_Display(client);
if (Get_Req_Type(client) == OPEN_DISPLAY_REQUEST_TYPE) {
if (Get_Test_Type(client) == OPEN_DISPLAY) {
Log_Msg ("INTERNAL ERROR: should not be getting SetupData with TestType == OPEN_DISPLAY.");
Delete();
/*NOTREACHED*/
}
time_proc = Good_Open_Timeout_Func;
} else
time_proc = Normal_Timeout_Func;
Set_Timer (CONNECT_TIMER_ID, Xst_timeout_value, time_proc);
if (!needswap) {
Xst_EINTR_Read (dpy, (char *) setupdp, len);
Stop_Timer (CONNECT_TIMER_ID);
return;
}
else {
Xst_EINTR_Read (dpy, (char *) buffer, len);
Stop_Timer (CONNECT_TIMER_ID);
bptr = buffer;
setupdp -> release = unpack4 (&bptr, needswap);
setupdp -> ridBase = unpack4 (&bptr, needswap);
setupdp -> ridMask = unpack4 (&bptr, needswap);
setupdp -> motionBufferSize = unpack4 (&bptr, needswap);
setupdp -> nbytesVendor = unpack2 (&bptr, needswap);
setupdp -> maxRequestSize = unpack2 (&bptr, needswap);
setupdp -> numRoots = unpack1 (&bptr);
setupdp -> numFormats = unpack1 (&bptr);
setupdp -> imageByteOrder = unpack1 (&bptr);
setupdp -> bitmapBitOrder = unpack1 (&bptr);
setupdp -> bitmapScanlineUnit = unpack1 (&bptr);
setupdp -> bitmapScanlinePad = unpack1 (&bptr);
setupdp -> minKeyCode = unpack1 (&bptr);
setupdp -> maxKeyCode = unpack1 (&bptr);
setupdp -> pad2 = unpack4 (&bptr, needswap);
sptr = (char *) (setupdp + 1);
/* get the vendor string */
bcopy (bptr, sptr, setupdp -> nbytesVendor);
pad = (setupdp -> nbytesVendor + 3) & ~3;
bptr += pad;
sptr += pad;
/* Z axis screen format info */
/* NOTE - this counts on only 1 byte quantities in the format!! */
for (f = 0; f < setupdp->numFormats; f++) {
bcopy (bptr, sptr, sizeof (xPixmapFormat));
bptr += sizeof (xPixmapFormat);
sptr += sizeof (xPixmapFormat);
}
/* Screen structures */
for (s = 0; s < setupdp->numRoots; s++) {
for (i = 0; i < 5; i++) {
swapcplp (bptr, sptr);
bptr += 4;
sptr += 4;
}
for (i = 0; i < 6; i++) {
swapcpsp (bptr, sptr);
bptr += 2;
sptr += 2;
}
swapcplp (bptr, sptr); /* visualID */
bptr += 4;
sptr += 4;
bcopy (bptr, sptr, 4);
ndepths = bptr[3]; /* pull out nDepths */
bptr += 4;
sptr += 4;
for (d = 0; d < ndepths; d++) {
*sptr++ = *bptr++;
*sptr++ = *bptr++;
swapcpsp (bptr, sptr);/* nVisuals */
nvisuals = * (short *) sptr;
bptr += 2;
sptr += 2;
bptr += 4; /* pad */
sptr += 4;
for (v = 0; v < nvisuals; v++) {
swapcplp (bptr, sptr);/* visualid */
bptr += 4;
sptr += 4;
*sptr++ = *bptr++;
*sptr++ = *bptr++;
swapcpsp (bptr, sptr);/* colormapEntries */
bptr += 2;
sptr += 2;
for (i = 0; i < 4; i++) {
swapcplp (bptr, sptr);
bptr += 4;
sptr += 4;
}
}
}
}
}
}
|