filepath(3) - Linux man page
Name
filepath - return the whole search path of a file
Synopsys
#include "mut.h" char ∗filepath(name, extension) char ∗name, ∗extension;
Parameters
- name
Name of the file to be search for
extension
File extension
Description
filepath return the absolute path of a cell. This is useful for error messages, since the caller of mbk file functions is not able to specify
explicitly which file it opened. Having such an information is also necessary when last modification times or access times are needed, as for consistency
checks. The file is searched through the environment variable mbk_work_lib(1), and if not found, through mbk_cata_lib(1) in the user defined
order.
The file to be searched is called name.extension, if extension is not NULL, else it is name. If extension is the empty string,
"", then the file name will be name. .
Return Value
filepath returns NULL on failure, ie the file is not in the pathes, or the absolute path on success. The value returned, when not NULL, is stored in a static buffer, so this values is to use at return time or copied into a user buffer.
Example
#include <stdio.h> #include "mut.h" #include "mph.h" void vti_error(fig, error) phfig_list ∗fig; char *(*error)(); {fprintf(stderr, "Syntax error in %s\n", filepath(fig->NAME, "cp"));
fprintf(stderr, "%s\n", error());
- }
See Also
mbk(1), mbk_work_lib(1), mbk_cata_lib(1), mbkfopen(3). mbkunlink(3).