1FILEPATH(3) MBK UTILITY FUNCTIONS FILEPATH(3)
2
3
4
6 filepath - return the whole search path of a file
7
9 #include "mut.h"
10 char ∗filepath(name, extension)
11 char ∗name, ∗extension;
12
14 name Name of the file to be search for
15
16 extension File extension
17
19 filepath return the absolute path of a cell. This is useful for error
20 messages, since the caller of mbk file functions is not able to specify
21 explicitly which file it opened. Having such an information is also
22 necessary when last modification times or access times are needed, as
23 for consistency checks. The file is searched through the environment
24 variable MBK_WORK_LIB(1), and if not found, through MBK_CATA_LIB(1) in
25 the user defined order.
26 The file to be searched is called name.extension, if extension is not
27 NULL, else it is name. If extension is the empty string, "", then the
28 file name will be name. .
29
31 filepath returns NULL on failure, ie the file is not in the paths, or
32 the absolute path on success. The value returned, when not NULL, is
33 stored in a static buffer, so this values is to use at return time or
34 copied into a user buffer.
35
37 #include <stdio.h>
38 #include "mut.h"
39 #include "mph.h"
40 void vti_error(fig, error)
41 phfig_list ∗fig;
42 char *(*error)();
43 {
44 fprintf(stderr, "Syntax error in %s\n", filepath(fig->NAME, "cp"));
45 fprintf(stderr, "%s\n", error());
46 }
47
49 mbk(1), MBK_WORK_LIB(1), MBK_CATA_LIB(1), mbkfopen(3). mbkunlink(3).
50
51
52
53
54
55
56ASIM/LIP6 October 1, 1997 FILEPATH(3)