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

Comparing ray/src/common/fputword.c (file contents):
Revision 3.8 by greg, Fri Apr 2 21:41:23 2004 UTC vs.
Revision 3.11 by greg, Sat Aug 3 15:32:59 2024 UTC

# Line 2 | Line 2
2   static const char       RCSid[] = "$Id$";
3   #endif
4   /*
5 < * Read white space separated words from stream
5 > * Write word to stream, quoting as necessary
6   *
7   *  External symbols declared in rtio.h
8   */
# Line 25 | Line 25 | FILE  *fp;
25          for (cp = s; *cp; cp++)
26                  if (isspace(*cp))
27                          hasspace++;
28 <                else if (*cp == '"')
28 >                else if ((cp > s) & (*cp == '"') && cp[1])
29                          quote = '\'';
30 <                else if (*cp == '\'')
30 >                else if ((cp > s) & (*cp == '\'') && cp[1])
31                          quote = '"';
32  
33 <        if (hasspace || quote) {        /* output with quotes */
33 >        if (!*s | hasspace | quote) {   /* output with quotes */
34                  if (!quote) quote = '"';
35                  fputc(quote, fp);
36                  fputs(s, fp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines