Previous: base_name, Up: File Directory [Contents]
Search a set of paths for a file.
#include <suplib/file.h> char *searchpath( char *file, char *default_path, char *path_spec );
char *file
the file to look for
char *default_path
the default path
char *path_spec
the list of paths
searchpath
scans a list of paths for a file. The paths are
specified in a string, separated by the PATHSEP
character
(‘:’ for UNIX). The paths are searched in the order that they occur in
the string. If an empty path is found in the specification, a user
specified default path (or the current directory, should this not be
specified) will be searched at that point. If the filename
begins with DIRSEP
(‘/’ for UNIX), it is used directly.
It returns a pointer to a dynamically allocated string holding the
complete path, or NULL
if it couldn’t find the file or it
ran out of memory. The calling procedure must free this string.
Diab Jerius