gisbase.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**********************************************************************
  2. *
  3. * char *
  4. * G_gisbase()
  5. *
  6. * returns: pointer to string containing the base directory of
  7. * GRASS-GRID
  8. **********************************************************************/
  9. #include <grass/gis.h>
  10. /*!
  11. * \brief top level module directory
  12. *
  13. * Returns the full
  14. * path name of the top level directory for GRASS programs. This directory will
  15. * have subdirectories which will contain modules and files required for the
  16. * running of the system. Some of these directories are:
  17. \code
  18. bin commands run by the user
  19. etc modules and data files used by GRASS commands
  20. txt help files
  21. menu files used by the <i>grass3</i> menu interface
  22. \endcode
  23. * The use of G_gisbase( ) to find these subdirectories enables GRASS modules
  24. * to be written independently of where the GRASS system is actually installed
  25. * on the machine. For example, to run the module <i>sroff</i> in the GRASS
  26. * <i>etc</i> directory:
  27. \code
  28. char command[200];
  29. sprintf (command, "%s/etc/sroff", G_gisbase( ) );
  30. G_spawn (command, "sroff", NULL);
  31. \endcode
  32. *
  33. * \param void
  34. * \return char *
  35. */
  36. const char *G_gisbase(void)
  37. {
  38. return G_getenv("GISBASE");
  39. }