| 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 |
|
*/ |
| 10 |
|
#include "copyright.h" |
| 11 |
|
|
| 12 |
|
#include <ctype.h> |
| 13 |
– |
#include <stdio.h> |
| 13 |
|
|
| 14 |
|
#include "rtio.h" |
| 15 |
|
|
| 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 */ |