ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/fputword.c
Revision: 3.2
Committed: Tue Feb 25 02:47:21 2003 UTC (21 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R5
Changes since 3.1: +1 -56 lines
Log Message:
Replaced inline copyright notice with #include "copyright.h"

File Contents

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id$";
3 #endif
4 /*
5 * Read white space separated words from stream
6 *
7 * External symbols declared in standard.h
8 */
9
10 #include "copyright.h"
11
12 #include <stdio.h>
13
14 #include <ctype.h>
15
16
17 void
18 fputword(s, fp) /* put (quoted) word to file stream */
19 char *s;
20 FILE *fp;
21 {
22 register char *cp;
23 /* check if quoting needed */
24 for (cp = s; *cp; cp++)
25 if (isspace(*cp)) {
26 int quote;
27 if (index(s, '"'))
28 quote = '\'';
29 else
30 quote = '"';
31 fputc(quote, fp);
32 fputs(s, fp);
33 fputc(quote, fp);
34 return;
35 }
36 /* output sans quotes */
37 fputs(s, fp);
38 }