GRASS Programmer's Manual
6.4.2(2012)
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
mapset.c
Go to the documentation of this file.
1
2
/**********************************************************************
3
*
4
* char *
5
* G_mapset()
6
*
7
* returns: pointer to string containing the one word mapset
8
* name.
9
* NULL if user does not have access to mapset.
10
*
11
**********************************************************************/
12
13
#include <string.h>
14
#include <stdlib.h>
15
#include <grass/gis.h>
16
#include <grass/glocale.h>
17
18
31
char
*
G_mapset
(
void
)
32
{
33
static
char
mapset[GMAPSET_MAX];
34
static
int
first
= 1;
35
char
*m;
36
37
m =
G__mapset
();
38
if
(m ==
NULL
)
39
G_fatal_error
(_(
"MAPSET is not set"
));
40
41
if
(first)
42
first = 0;
43
else
if
(strcmp(mapset, m) == 0)
44
return
mapset;
45
strcpy(mapset, m);
46
47
switch
(
G__mapset_permissions
(mapset)) {
48
case
0:
49
case
1:
50
return
mapset;
51
/*
52
case 0:
53
G_fatal_error ("MAPSET %s - permission denied", mapset);
54
break;
55
*/
56
default
:
57
G_fatal_error
(_(
"MAPSET %s not found"
), mapset);
58
break
;
59
}
60
exit(EXIT_FAILURE);
61
}
62
63
char
*
G__mapset
(
void
)
64
{
65
return
G__getenv
(
"MAPSET"
);
66
}
lib
gis
mapset.c
Generated on Wed Jun 6 2012 14:04:26 for GRASS Programmer's Manual by
1.8.1