18 #include <grass/gis.h>
19 #include <grass/glocale.h>
21 static char *find_file(
int misc,
24 const char *
name,
const char *mapset)
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);
char * G_store(const char *s)
Copy string to allocated memory.
char * G__file_name_misc(char *path, const char *dir, const char *element, const char *name, const char *mapset)
char * G_find_file2_misc(const char *dir, const char *element, const char *name, const char *mapset)
char * G__file_name(char *path, const char *element, const char *name, const char *mapset)
Builds full path names to GIS data files.
char * G__mapset_name(int n)
Get name of the n'th mapset from the mapset_name[] list.
char * G_find_file2(const char *element, const char *name, const char *mapset)
searches for a file from the mapset search list or in a specified mapset. (look but don't touch) retu...
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
char * G_find_file_misc(const char *dir, const char *element, char *name, const char *mapset)
char * G_find_file(const char *element, char *name, const char *mapset)
searches for a file from the mapset search list or in a specified mapset. returns the mapset name whe...
int G_legal_filename(const char *s)
Check for legal database file name.
int G__name_is_fully_qualified(const char *fullname, char *name, char *mapset)
Check if map name is fully qualified (map @ mapset)