18 #include <grass/gis.h>
19 #include <grass/glocale.h>
21 static char *find_file(
int misc,
24 const char *
name,
const char *mapset)
27 char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
28 const char *pname, *pmapset;
61 if (pmapset ==
NULL || *pmapset == 0) {
63 const char *pselmapset =
NULL;
70 if (access(path, 0) == 0) {
74 G_warning(_(
"'%s/%s' was found in more mapsets (also found in <%s>)"),
75 element, pname, pmapset);
85 return (
char *)pselmapset;
100 if (access(path, 0) == 0)
109 static char *find_file1(
int misc,
111 const char *element,
char *name,
const char *mapset)
113 char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
114 const char *pname, *pmapset;
126 mp = find_file(misc, dir, element, pname, pmapset);
128 if (mp && name != pname)
159 char *
G_find_file(
const char *element,
char *name,
const char *mapset)
161 return find_file1(0,
NULL, element, name, mapset);
165 const char *element,
char *name,
const char *mapset)
167 return find_file1(1, dir, element, name, mapset);
191 char *
G_find_file2(
const char *element,
const char *name,
const char *mapset)
193 return find_file(0,
NULL, element, name, mapset);
198 const char *name,
const char *mapset)
200 return find_file(1, dir, element, name, mapset);