--- ray/src/rt/x11.c 2004/03/30 16:13:01 2.32 +++ ray/src/rt/x11.c 2024/08/05 21:54:01 2.37 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: x11.c,v 2.32 2004/03/30 16:13:01 schorsch Exp $"; +static const char RCSid[] = "$Id: x11.c,v 2.37 2024/08/05 21:54:01 greg Exp $"; #endif /* * x11.c - driver for X-windows version 11 @@ -9,11 +9,6 @@ static const char RCSid[] = "$Id: x11.c,v 2.32 2004/03 #include "standard.h" #include -#ifdef sparc -#include -#include -#include -#endif #if !defined(FNDELAY) && defined(O_NONBLOCK) #define FNDELAY O_NONBLOCK #endif @@ -211,8 +206,10 @@ x11_init( /* initialize driver */ x11_driver.comin = x11_comin; x11_driver.comout = x11_comout; erract[COMMAND].pf = x11_comout; + /* doesn't work with raypcalls.c if (erract[WARNING].pf != NULL) erract[WARNING].pf = x11_errout; + */ inpcheck = IC_X11; } else { x11_driver.comin = std_comin; @@ -375,7 +372,7 @@ x11_comin( /* read in a command line */ static void x11_comout( /* output a string to command line */ - char *outp + const char *outp ) { if (comline == NULL || outp == NULL || !outp[0]) @@ -402,6 +399,8 @@ std_comin( /* read in command line from stdin */ char *prompt ) { + int n, c; + if (prompt != NULL) { if (fromcombuf(inp, &x11_driver)) return; @@ -417,19 +416,23 @@ std_comin( /* read in command line from stdin */ inpcheck = IC_IOCTL; } #endif - if (gets(inp) == NULL) { + n = 0; /* gets() no longer exists... */ + while ((c = getchar()) != EOF && c != '\n') + inp[n++] = c; + + if (!n & (c == EOF)) { strcpy(inp, "quit"); return; } - x11_driver.inpready -= strlen(inp) + 1; - if (x11_driver.inpready < 0) - x11_driver.inpready = 0; + inp[n] = '\0'; + x11_driver.inpready -= n + 1; + x11_driver.inpready *= (x11_driver.inpready > 0); } static void std_comout( /* write out string to stdout */ - char *outp + const char *outp ) { fputs(outp, stdout); @@ -561,7 +564,7 @@ true_pixel( /* return true pixel value for color */ ) { unsigned long rval; - BYTE rgb[3]; + uby8 rgb[3]; map_color(rgb, col); rval = ourvinfo.red_mask*rgb[RED]/255 & ourvinfo.red_mask;