YAZ
5.34.0
|
File Path utilities. More...
Go to the source code of this file.
Functions | |
int | yaz_is_abspath (const char *path) |
checks whether path is absolute More... | |
size_t | yaz_filepath_comp (const char **path_p, const char **comp) |
get next path component in filepath More... | |
char * | yaz_filepath_resolve (const char *fname, const char *path, const char *base, char *fullpath) |
resolve file on path More... | |
FILE * | yaz_fopen (const char *path, const char *fname, const char *mode, const char *base) |
opens first file in path in path More... | |
FILE * | yaz_path_fopen (const char *path, const char *fname, const char *mode) |
opens first file in path in path More... | |
int | yaz_fclose (FILE *f) |
closes file More... | |
File Path utilities.
Definition in file tpath.h.
int yaz_fclose | ( | FILE * | f | ) |
size_t yaz_filepath_comp | ( | const char ** | path_p, |
const char ** | comp | ||
) |
get next path component in filepath
path_p | pointer to path (updated to "next" entry if any) |
comp | upon pointer to component (if component is found) |
0 | no component found (and no more componennts) |
>0 | length of component (length of *comp) |
A filepath has components separted by colon. For example /usr/lib/modules:c:/my:/:lib which has these components "/usr/lib/modules", "c:/my", "/", "lib"
Definition at line 44 of file tpath.c.
Referenced by yaz_filepath_resolve().
char* yaz_filepath_resolve | ( | const char * | fname, |
const char * | path, | ||
const char * | base, | ||
char * | fullpath | ||
) |
resolve file on path
fname | "short" filename (without path) |
path | the path (dir1:dir2,..) - ala Unix |
base | can be added to relative paths (NULL for no append) |
fullpath | the full path to filename (if successful) |
Be sure to allocate at least 1024 bytes for fullpath
Definition at line 74 of file tpath.c.
References yaz_filepath_comp().
Referenced by xml_config_read(), and yaz_fopen().
FILE* yaz_fopen | ( | const char * | path, |
const char * | fname, | ||
const char * | mode, | ||
const char * | base | ||
) |
opens first file in path in path
fname | "short" filename (without path) |
mode | mode as in fopen(3) |
path | the path (dir1:dir2,..) - ala Unix |
base | can be added to relative paths (NULL for no append) |
Definition at line 117 of file tpath.c.
References yaz_filepath_resolve().
Referenced by yaz_path_fopen().
int yaz_is_abspath | ( | const char * | path | ) |
checks whether path is absolute
path | path to checked |
1 | path is absolute |
0 | path is relative |
Definition at line 127 of file tpath.c.
Referenced by conf_dir_path().
FILE* yaz_path_fopen | ( | const char * | path, |
const char * | fname, | ||
const char * | mode | ||
) |
opens first file in path in path
fname | "short" filename (without path) |
mode | mode as in fopen(3) |
path | the path (dir1:dir2,..) - ala Unix |
Definition at line 33 of file tpath.c.
References name, and yaz_fopen().