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.3 by greg, Thu Mar 27 04:16:33 2003 UTC vs.
Revision 3.10 by greg, Fri Nov 13 01:06:14 2020 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 standard.h
7 > *  External symbols declared in rtio.h
8   */
9  
10   #include "copyright.h"
11  
12 #include <stdio.h>
13
12   #include <ctype.h>
13  
14 + #include "rtio.h"
15  
16   void
17   fputword(s, fp)                 /* put (quoted) word to file stream */
# Line 26 | 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 */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines