Back to index

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

Go to the source code of this file.

Functions

FILE * frlibopen (char *fname)

Variables

static const char RCSid [] = "$Id: fropen.c,v 2.14 2003/08/26 04:24:26 greg Exp $"

Function Documentation

FILE* frlibopen ( char *  fname)

Definition at line 19 of file fropen.c.

{
       FILE  *fp;
       char  pname[PATH_MAX];
       register char  *sp, *cp;

       if (fname == NULL)
              return(NULL);

       if (ISDIRSEP(fname[0]) || fname[0] == '.')       /* absolute path */
              return(fopen(fname, "r"));
                                          /* check search path */
       sp = getrlibpath();
       do {
              cp = pname;
              while (*sp && (*cp = *sp++) != PATHSEP)
                     cp++;
              if (cp > pname && !ISDIRSEP(cp[-1]))
                     *cp++ = DIRSEP;
              strcpy(cp, fname);
              if ((fp = fopen(pname, "r")) != NULL)
                     return(fp);                 /* got it! */
       } while (*sp);
                                          /* not found */
       return(NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const char RCSid[] = "$Id: fropen.c,v 2.14 2003/08/26 04:24:26 greg Exp $" [static]

Definition at line 2 of file fropen.c.