GRASS Programmer's Manual
6.4.3(2013)-r
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
paths.c
Go to the documentation of this file.
1
#include <sys/types.h>
2
#include <sys/stat.h>
3
#include <unistd.h>
4
#include <grass/gis.h>
5
17
int
G_mkdir
(
const
char
*path)
18
{
19
#ifdef __MINGW32__
20
return
mkdir(path);
21
#else
22
return
mkdir(path, 0777);
23
#endif
24
}
25
35
int
G_is_dirsep
(
char
c)
36
{
37
if
(c == GRASS_DIRSEP || c == HOST_DIRSEP)
38
return
1;
39
else
40
return
0;
41
}
42
52
int
G_is_absolute_path
(
const
char
*path)
53
{
54
if
(
G_is_dirsep
(path[0])
55
#ifdef __MINGW32__
56
|| (isalpha(path[0]) && (path[1] ==
':'
) &&
G_is_dirsep
(path[2]))
57
#endif
58
)
59
return
1;
60
else
61
return
0;
62
}
63
73
char
*
G_convert_dirseps_to_host
(
char
*path)
74
{
75
char
*i;
76
77
for
(i = path; *i; i++) {
78
if
(*i == GRASS_DIRSEP)
79
*i = HOST_DIRSEP;
80
}
81
82
return
path;
83
}
84
95
char
*
G_convert_dirseps_from_host
(
char
*path)
96
{
97
char
*i;
98
99
for
(i = path; *i; i++) {
100
if
(*i == HOST_DIRSEP)
101
*i = GRASS_DIRSEP;
102
}
103
104
return
path;
105
}
106
118
int
G_stat
(
const
char
*
file_name
,
struct
stat *buf)
119
{
120
return
stat(file_name, buf);
121
}
122
135
int
G_lstat
(
const
char
*
file_name
,
struct
stat *buf)
136
{
137
#ifdef __MINGW32__
138
return
stat(file_name, buf);
139
#else
140
return
lstat(file_name, buf);
141
#endif
142
}
lib
gis
paths.c
Generated on Thu Sep 26 2013 09:48:05 for GRASS Programmer's Manual by
1.8.4