Back to index

radiance  4R0+20100331
Functions | Variables
fputword.c File Reference
#include "copyright.h"
#include <ctype.h>
#include "rtio.h"

Go to the source code of this file.

Functions

void fputword (char *s, FILE *fp)

Variables

static const char RCSid [] = "$Id: fputword.c,v 3.8 2004/04/02 21:41:23 greg Exp $"

Function Documentation

void fputword ( char *  s,
FILE *  fp 
)

Definition at line 17 of file fputword.c.

{
       int           hasspace = 0;
       int           quote = 0;
       register char *cp;
                                   /* check if quoting needed */
       for (cp = s; *cp; cp++)
              if (isspace(*cp))
                     hasspace++;
              else if (*cp == '"')
                     quote = '\'';
              else if (*cp == '\'')
                     quote = '"';

       if (hasspace || quote) {    /* output with quotes */
              if (!quote) quote = '"';
              fputc(quote, fp);
              fputs(s, fp);
              fputc(quote, fp);
       } else                      /* output sans quotes */
              fputs(s, fp);
}

Here is the caller graph for this function:


Variable Documentation

const char RCSid[] = "$Id: fputword.c,v 3.8 2004/04/02 21:41:23 greg Exp $" [static]

Definition at line 2 of file fputword.c.