GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
find_vect.c
Go to the documentation of this file.
1 /*!
2  \file lib/gis/find_vect.c
3 
4  \brief GIS library - Find a vector map
5 
6  (C) 2001-2009 by the GRASS Development Team
7 
8  This program is free software under the GNU General Public License
9  (>=v2). Read the file COPYING that comes with GRASS for details.
10 
11  \author Original author CERL
12  */
13 
14 #include <string.h>
15 
16 #include <grass/config.h>
17 #include <grass/gis.h>
18 #include <grass/vect/dig_defines.h>
19 #include <grass/glocale.h>
20 
21 /*!
22  \brief Finds a vector map
23 
24  Searches for a vector map from the mapset search list or in a
25  specified mapset. Returns the mapset name where the vector map was
26  found.
27 
28  NOTES:
29  If the user specifies a fully qualified vector map which exists,
30  then G_find_vector() modifies <i>name</i> by removing the
31  "@<i>mapset</i>" part.
32 
33  Rejects all names that begin with "."
34 
35  \param name vector map name
36  \param mapset mapset name or "" for search path
37 
38  \return pointer to a string with name of mapset where vector map was found
39  \return NULL if not found
40  */
41 const char *G_find_vector(char *name, const char *mapset)
42 {
43  G_debug(1, "G_find_vector(): name=%s mapset=%s", name, mapset);
44  return G_find_file(GV_DIRECTORY, name, mapset);
45 }
46 
47 /*!
48  * \brief Find a vector map (look but don't touch)
49  *
50  * The same as G_find_vector() but doesn't remove the "@<i>mapset</i>"
51  * qualification from <i>name</i>, if present.
52  *
53  * Returns NULL if the map wasn't found, or the mapset the vector was
54  * found in if it was.
55  *
56  * \param name vector map name
57  * \param mapset mapset name where to search
58  *
59  * \return pointer to buffer containing mapset name
60  * \return NULL when vector map not found
61  */
62 const char *G_find_vector2(const char *name, const char *mapset)
63 {
64  G_debug(1, "G_find_vector2(): name=%s mapset=%s", name, mapset);
65  return G_find_file2(GV_DIRECTORY, name, mapset);
66 }
const char * G_find_file2(const char *, const char *, const char *)
Searches for a file from the mapset search list or in a specified mapset. (look but don't touch)
Definition: find_file.c:234
int G_debug(int, const char *,...) __attribute__((format(printf
const char * G_find_file(const char *, char *, const char *)
Searches for a file from the mapset search list or in a specified mapset.
Definition: find_file.c:186
#define GV_DIRECTORY
Name of vector directory.
Definition: dig_defines.h:8
const char * G_find_vector2(const char *name, const char *mapset)
Find a vector map (look but don't touch)
Definition: find_vect.c:62
const char * G_find_vector(char *name, const char *mapset)
Finds a vector map.
Definition: find_vect.c:41
const char * name
Definition: named_colr.c:6