ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/x11.c
(Generate patch)

Comparing ray/src/rt/x11.c (file contents):
Revision 2.36 by greg, Thu May 23 22:45:05 2024 UTC vs.
Revision 2.37 by greg, Mon Aug 5 21:54:01 2024 UTC

# Line 399 | Line 399 | std_comin(             /* read in command line from stdin */
399          char  *prompt
400   )
401   {
402 +        int     n, c;
403 +
404          if (prompt != NULL) {
405                  if (fromcombuf(inp, &x11_driver))
406                          return;
# Line 414 | Line 416 | std_comin(             /* read in command line from stdin */
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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines