16 #include <sys/types.h>
18 #include <grass/gis.h>
19 #include <grass/glocale.h>
56 if (*element ==
'/' || *element == 0) {
58 if (access(path, 0) != 0) {
61 p_element, path, strerror(
errno));
63 if (access(path, 0) != 0)
64 G_fatal_error(_(
"Unable to access mapset element %s (%s): %s"),
65 p_element, path, strerror(
errno));
84 char buf[GNAME_MAX * 2 + 1];
86 sprintf(buf,
"%s/%s", dir, name);
90 static int check_owner(
const struct stat *
info)
92 #if defined(__MINGW32__) || defined(SKIP_MAPSET_OWN_CHK)
95 const char *check =
getenv(
"GRASS_SKIP_MAPSET_OWNER_CHECK");
98 if (info->st_uid != getuid())
100 if (info->st_uid != geteuid())
117 char path[GPATH_MAX];
122 if (
G_stat(path, &info) != 0)
124 if (!S_ISDIR(info.st_mode))
127 if (!check_owner(&info))
147 char path[GPATH_MAX];
150 sprintf(path,
"%s/%s/%s", gisdbase, location, mapset);
152 if (
G_stat(path, &info) != 0)
154 if (!S_ISDIR(info.st_mode))
157 if (!check_owner(&info))
char * G_mapset(void)
current mapset name
def info
Display an informational message using g.message -i
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
int G__mapset_permissions(const char *mapset)
Check for user mapset permission.
int G_stat(const char *file_name, struct stat *buf)
Get file status.
int G_mkdir(const char *path)
Creates a new directory.
int G__mapset_permissions2(const char *gisdbase, const char *location, const char *mapset)
Check for user mapset permission.
char * G__file_name(char *path, const char *element, const char *name, const char *mapset)
Builds full path names to GIS data files.
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
int G__make_mapset_element_misc(const char *dir, const char *name)
Create misc element in the current mapset.
int G__make_mapset_element(const char *p_element)
Create element in the current mapset.
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.