GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-602118adcc
gisbase.c
Go to the documentation of this file.
1
/**********************************************************************
2
*
3
* char *
4
* G_gisbase()
5
*
6
* returns: pointer to string containing the base directory of
7
* GRASS-GRID
8
**********************************************************************/
9
10
#include <
grass/gis.h
>
11
12
/*!
13
* \brief Get full path name of the top level module directory
14
*
15
* Returns the full path name of the top level directory for GRASS
16
* programs. This directory will have subdirectories which will
17
* contain modules and files required for the running of the
18
* system. Some of these directories are:
19
20
\verbatim
21
bin commands run by the user
22
etc modules and data files used by GRASS commands
23
\endverbatim
24
25
* The use of G_gisbase() to find these subdirectories enables GRASS
26
* modules to be written independently of where the GRASS system is
27
* actually installed on the machine. For example, to run the module
28
* <i>sroff</i> in the GRASS <i>etc</i> directory:
29
30
\code
31
char command[200];
32
33
sprintf(command, "%s/etc/sroff", G_gisbase());
34
G_spawn(command, "sroff", NULL);
35
\endcode
36
*
37
* \return pointer to a string
38
*/
39
const
char
*
G_gisbase
(
void
)
40
{
41
return
G_getenv
(
"GISBASE"
);
42
}
G_getenv
const char * G_getenv(const char *)
Get environment variable.
Definition:
env.c:360
gis.h
G_gisbase
const char * G_gisbase(void)
Get full path name of the top level module directory.
Definition:
gisbase.c:39
lib
gis
gisbase.c
Generated on Mon Nov 18 2024 06:59:52 for GRASS GIS 8 Programmer's Manual by
1.9.1