#include <cfht/cfht.h>#include <cfht/cfp.h>char *cfp_file(dest, name, suff, mode)char *dest;char *name;char *suff;char *mode; libcfht.a
Dest is the place where the path name to the found file will be placed. If dest is NULL, then library internal space will be used. Name is the simple name of the file. Suff will be appended onto name to get the true file name. NULL is allowed for suff. The created name will be getenv()’ed for possible overrides. Mode is an access specification string such as "rw" or "r".
The current directory is checked first. If the file is there, but not accessible with the specified mode, an error will occur. The $HOME environment variable is checked next. For this check a ".," will be prepended to the file name. This allows all configuration files to be hidden and easily pattern matched. If the file is there, but not accessible with the specified mode, an error will occur. The $CFHTCONFPATH environment variable is checked last. (Programmers can get the name of the variable by using the CFHT_ECONFPATH define.) $CFHTCONFPATH should specify a directory name. If the file is found in the $CFHTCONFPATH directory, and writing is desired as specified by mode, the file will be copied to the $HOME directory (with ".," prepended), and the path to the $HOME file will be returned. If the file is found in the $CFHTCONFPATH directory, and writing is not desired as specified by mode, then the path to the $CFHTCONFPATH file will be returned. The name of the system default directory for configuration files can be found by using the CFHT_CONFPATH define.
Actually one further place is checked. If the file is not in the configuration directory, "../../conf" from the configuration directory is checked. This is a global, release independent directory, for things such as the odometer file and ioconfig file.