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
is.c
Go to the documentation of this file.
1
17
#include <stdio.h>
18
#include <string.h>
19
#include <unistd.h>
20
#include <grass/gis.h>
21
22
23
static
int
test_path_file(
const
char
*,
const
char
*);
24
25
26
static
int
test_path_file(
const
char
*path,
const
char
*file)
27
{
28
int
ret;
29
char
*buf;
30
31
buf = (
char
*)G_malloc(strlen(path) + strlen(file) + 2);
32
sprintf(buf,
"%s/%s"
, path, file);
33
34
ret = access(buf, F_OK);
35
G_free
(buf);
36
37
if
(ret == 0)
38
return
1;
39
40
return
0;
41
}
42
43
53
int
G_is_gisbase
(
const
char
*path)
54
{
55
return
test_path_file(path,
"etc/element_list"
);
56
}
57
58
67
int
G_is_location
(
const
char
*path)
68
{
69
return
test_path_file(path,
"PERMANENT/DEFAULT_WIND"
);
70
}
71
72
81
int
G_is_mapset
(
const
char
*path)
82
{
83
return
test_path_file(path,
"WIND"
);
84
}
lib
gis
is.c
Generated on Sun Mar 16 2014 05:07:46 for GRASS Programmer's Manual by
1.8.1.2