Back to index

radiance  4R0+20100331
Functions | Variables
fgetline.c File Reference
#include "copyright.h"
#include "rtio.h"

Go to the source code of this file.

Functions

char * fgetline (char *s, int n, FILE *fp)

Variables

static const char RCSid [] = "$Id: fgetline.c,v 2.7 2004/09/14 02:53:50 greg Exp $"

Function Documentation

char* fgetline ( char *  s,
int  n,
FILE *  fp 
)

Definition at line 21 of file fgetline.c.

{
       register char  *cp = s;
       register int  c = EOF;

       while (--n > 0 && (c = getc(fp)) != EOF) {
              if (c == '\r' && (c = getc(fp)) != '\n') {
                     ungetc(c, fp);              /* must be Apple file */
                     c = '\n';
              }
              if (c == '\n' && (cp == s || cp[-1] != '\\'))
                     break;
              *cp++ = c;
       }
       if (cp == s && c == EOF)
              return(NULL);
       *cp = '\0';
       return(s);
}

Here is the caller graph for this function:


Variable Documentation

const char RCSid[] = "$Id: fgetline.c,v 2.7 2004/09/14 02:53:50 greg Exp $" [static]

Definition at line 2 of file fgetline.c.