21 static const char *find_element(
int misc,
const char *dir,
const char *
element)
23 static const char *cell_elements[] = {
"cellhd",
"cell",
"cats",
24 "colr",
"hist",
"cell_misc",
25 "fcell",
"g3dcell",
NULL};
26 static const char *dig_elements[] = {
27 "dig",
"dig_att",
"dig_plus",
"dig_cats",
"dig_misc",
"reg",
NULL};
28 const char *search = misc ? dir :
element;
31 for (i = 1; cell_elements[i]; i++)
32 if (strcmp(search, cell_elements[i]) == 0)
33 return cell_elements[0];
34 for (i = 1; dig_elements[i]; i++)
35 if (strcmp(search, dig_elements[i]) == 0)
36 return dig_elements[0];
40 static const char *find_file(
int misc,
const char *dir,
const char *
element,
41 const char *
name,
const char *mapset)
45 const char *pname, *pmapset;
65 if (strcmp(
element,
"vector") == 0 && pmapset &&
66 strcasecmp(pmapset,
"ogr") == 0) {
84 if (pmapset ==
NULL || *pmapset == 0) {
86 const char *pselmapset =
NULL;
87 const char *pelement = find_element(misc, dir,
element);
90 if (misc &&
element == pelement)
94 if (access(
path, 0) == 0) {
99 "more mapsets (also found in <%s>)"),
109 if (access(
path, 0) == 0) {
112 if (cnt > 1 &&
element == pelement)
132 if (access(
path, 0) == 0)
139 static const char *find_file1(
int misc,
const char *dir,
const char *
element,
140 char *
name,
const char *mapset)
143 const char *pname, *pmapset;
155 mp = find_file(misc, dir,
element, pname, pmapset);
157 if (mp &&
name != pname)
258 const char *
name,
const char *mapset)
char * G_file_name_misc(char *, const char *, const char *, const char *, const char *)
Builds full path names to GIS misc data files.
int G_name_is_fully_qualified(const char *, char *, char *)
Check if map name is fully qualified (map @ mapset)
char * G_file_name(char *, const char *, const char *, const char *)
Builds full path names to GIS data files.
const char * G_get_mapset_name(int)
Get name of the n'th mapset from the current mapset search path.
int G_legal_filename(const char *)
Check for legal database file name.
void void void G_important_message(const char *,...) __attribute__((format(printf
char * G_store(const char *)
Copy string to allocated memory.
const 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.
const char * G_find_file_misc(const char *dir, const char *element, char *name, const char *mapset)
Searches for a misc file from the mapset search list or in a specified mapset.
const char * G_find_file2_misc(const char *dir, const char *element, const char *name, const char *mapset)
Searches for a misc file from the mapset search list or in a specified mapset. (look but don't touch)
const 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)