find_vect.c 1.8 KB

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