NAME
get_config_file - Finds a configuration file
SYNOPSIS
#include "l/l_config.h"
Example compile flags (system dependent):
-DLINUX_386 -DLINUX_386_P4
-I/home/kobus/include
-L/home/kobus/load/linux_386_p4 -L/usr/local/lib -L/usr/lib
-lKJB -llapack -lblas -lg2c -lXext -lX11
int get_config_file
(
const char *env_var,
const char *sub_dir,
const char *file_name,
const char *message_name,
char *config_file,
size_t config_file_size
);
DESCRIPTION
This routine implements essentially a "dry run" of open_config_file(). If a
config file is found, its name is put into the buffer "config_file", whose
size must be passed in via "config_file_name_size". The file must be
subsequently opened for use at some later point.
If the parameter "env_var" is not NULL, then it first tries using this string
as the configuration file name. Next it looks for "file_name" in the current
directory, then the user's home directory, and, depending on how the library
was built, then the "shared" home directory and/or the programmer's home
directory. If "directory" is not NULL, then it is used as a sub-directory in
all paths starting from a home directory (i.e., all paths except the current
directory).
RETURNS
Either NO_ERROR, or ERROR, with an appropriate error message being set.
EXAMPLE
Suppose directory is "x" and file_name is "y". Also supposed that the
shared directory is "~kobus" (compiled in constant) and the programmer's
directory is "~kobus" (another compiled in constant). Then the following
files are tried in the order listed.
./y
/config_dir/bob/x/y
/config_dir/kobus/x/y
~/x/y
~kobus/x/y
~kobus/x/y
where config_dir is one of a number strings tried in sequence. Currently
those strings are work, net/v04/work, data, net/v05/data, space, and
net/v05/space,
The file name actually used is put into the buffer config_file_name whose
size must be passed in via config_file_name_size;
The paramter message_name can be used to specify a name for the configuration
file to be used in composing an error message. Otherwise "configuration" i
used.
DISCLAIMER
This software is not adequatedly tested. It is recomended that
results are checked independantly where appropriate.
AUTHOR
Kobus Barnard
DOCUMENTOR
Kobus Barnard
SEE ALSO
check_config_sub_dir
,
read_dbl_from_config_file
,
open_config_file