| 9 |
|
|
| 10 |
|
#include "standard.h" |
| 11 |
|
#include <sys/ioctl.h> |
| 12 |
– |
#ifdef sparc |
| 13 |
– |
#include <sys/conf.h> |
| 14 |
– |
#include <sys/file.h> |
| 15 |
– |
#include <sys/filio.h> |
| 16 |
– |
#endif |
| 12 |
|
#if !defined(FNDELAY) && defined(O_NONBLOCK) |
| 13 |
|
#define FNDELAY O_NONBLOCK |
| 14 |
|
#endif |
| 206 |
|
x11_driver.comin = x11_comin; |
| 207 |
|
x11_driver.comout = x11_comout; |
| 208 |
|
erract[COMMAND].pf = x11_comout; |
| 209 |
+ |
/* doesn't work with raypcalls.c |
| 210 |
|
if (erract[WARNING].pf != NULL) |
| 211 |
|
erract[WARNING].pf = x11_errout; |
| 212 |
+ |
*/ |
| 213 |
|
inpcheck = IC_X11; |
| 214 |
|
} else { |
| 215 |
|
x11_driver.comin = std_comin; |
| 256 |
|
if (yres < MINHEIGHT) |
| 257 |
|
yres = MINHEIGHT; |
| 258 |
|
/* resize window */ |
| 259 |
< |
if (xres != gwidth || yres != gheight) { |
| 259 |
> |
if ((xres != gwidth) | (yres != gheight)) { |
| 260 |
|
XSelectInput(ourdisplay, gwind, 0); |
| 261 |
|
XResizeWindow(ourdisplay, gwind, xres, yres+comheight); |
| 262 |
|
gwidth = xres; |
| 267 |
|
} |
| 268 |
|
XClearWindow(ourdisplay, gwind); |
| 269 |
|
/* reinitialize color table */ |
| 270 |
< |
if (ourvinfo.class == PseudoColor || ourvinfo.class == GrayScale) { |
| 270 |
> |
if ((ourvinfo.class == PseudoColor) | (ourvinfo.class == GrayScale)) { |
| 271 |
|
if (getpixels() == 0) |
| 272 |
|
eputs("cannot allocate colors\n"); |
| 273 |
|
else |
| 372 |
|
|
| 373 |
|
static void |
| 374 |
|
x11_comout( /* output a string to command line */ |
| 375 |
< |
char *outp |
| 375 |
> |
const char *outp |
| 376 |
|
) |
| 377 |
|
{ |
| 378 |
< |
if (comline == NULL || outp == NULL || !outp[0]) |
| 378 |
> |
if ((comline == NULL) | (outp == NULL) || !outp[0]) |
| 379 |
|
return; |
| 380 |
|
xt_puts(outp, comline); |
| 381 |
|
if (outp[strlen(outp)-1] == '\n') |
| 399 |
|
char *prompt |
| 400 |
|
) |
| 401 |
|
{ |
| 402 |
+ |
int n, c; |
| 403 |
+ |
|
| 404 |
|
if (prompt != NULL) { |
| 405 |
|
if (fromcombuf(inp, &x11_driver)) |
| 406 |
|
return; |
| 416 |
|
inpcheck = IC_IOCTL; |
| 417 |
|
} |
| 418 |
|
#endif |
| 419 |
< |
if (gets(inp) == NULL) { |
| 419 |
> |
n = 0; /* gets() no longer exists... */ |
| 420 |
> |
while ((c = getchar()) != EOF && c != '\n') |
| 421 |
> |
inp[n++] = c; |
| 422 |
> |
|
| 423 |
> |
if (!n & (c == EOF)) { |
| 424 |
|
strcpy(inp, "quit"); |
| 425 |
|
return; |
| 426 |
|
} |
| 427 |
< |
x11_driver.inpready -= strlen(inp) + 1; |
| 428 |
< |
if (x11_driver.inpready < 0) |
| 429 |
< |
x11_driver.inpready = 0; |
| 427 |
> |
inp[n] = '\0'; |
| 428 |
> |
x11_driver.inpready -= n + 1; |
| 429 |
> |
x11_driver.inpready *= (x11_driver.inpready > 0); |
| 430 |
|
} |
| 431 |
|
|
| 432 |
|
|
| 433 |
|
static void |
| 434 |
|
std_comout( /* write out string to stdout */ |
| 435 |
< |
char *outp |
| 435 |
> |
const char *outp |
| 436 |
|
) |
| 437 |
|
{ |
| 438 |
|
fputs(outp, stdout); |
| 564 |
|
) |
| 565 |
|
{ |
| 566 |
|
unsigned long rval; |
| 567 |
< |
BYTE rgb[3]; |
| 567 |
> |
uby8 rgb[3]; |
| 568 |
|
|
| 569 |
|
map_color(rgb, col); |
| 570 |
|
rval = ourvinfo.red_mask*rgb[RED]/255 & ourvinfo.red_mask; |