find_vect.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. **********************************************************************
  3. * char *
  4. * G_find_vector (name, mapset)
  5. * char *name file name to look for
  6. * char *mapset mapset to search. if mapset is ""
  7. * will search in mapset search list
  8. *
  9. * searches for a vector map from the mapset search list
  10. * or in a specified mapset.
  11. * returns the mapset name where the vector map was found.
  12. *
  13. * NOTE: If the user specifies a fully qualified vector map which exists,
  14. * then <i>G_find_vector()</i> modifies <b>name</b> by removing the
  15. * "@<i>mapset</i>" part.
  16. *
  17. * returns:
  18. * char * pointer to a string with name of mapset
  19. * where vector map was found, or NULL if not found
  20. * note:
  21. * rejects all names that begin with .
  22. *
  23. * if name is of the form nnn in ppp then
  24. * name = nnn and mapset = ppp
  25. **********************************************************************/
  26. #include <grass/gis.h>
  27. #include <grass/vect/dig_defines.h>
  28. /* \brief searches for a vector map
  29. *
  30. * searches for a vector map from the mapset search list
  31. * or in a specified mapset.
  32. * returns the mapset name where the vector map was found.
  33. *
  34. * returns:
  35. * char * pointer to a string with name of mapset
  36. * where vector map was found, or NULL if not found
  37. * NOTES:
  38. * If the user specifies a fully qualified vector map which exists,
  39. * then <i>G_find_vector()</i> modifies <b>name</b> by removing the
  40. * "@<i>mapset</i>" part.
  41. *
  42. * Rejects all names that begin with "."
  43. *
  44. * If name is of the form nnn in ppp then
  45. * name = nnn and mapset = ppp
  46. *
  47. * \param name
  48. * \param mapset
  49. * \return char *
  50. *
  51. */
  52. char *G_find_vector(char *name, const char *mapset)
  53. {
  54. return G_find_file(GRASS_VECT_DIRECTORY, name, mapset);
  55. }
  56. /*!
  57. * \brief find a vector map (look but don't touch)
  58. *
  59. * The same as G_find_vector() but doesn't remove the "@<i>mapset</i>"
  60. * qualification from <b>name</b>, if present.
  61. *
  62. * Returns NULL if the map wasn't found, or the mapset the vector was
  63. * found in if it was.
  64. *
  65. * \param name
  66. * \param mapset
  67. * \return char *
  68. */
  69. char *G_find_vector2(const char *name, const char *mapset)
  70. {
  71. return G_find_file2(GRASS_VECT_DIRECTORY, name, mapset);
  72. }