GRASS GIS 8 Programmer's Manual
8.5.0dev(2025)-565e82de51
Main Page
Related Pages
Data Structures
Data Structures
Class Hierarchy
Data Fields
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
x
y
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
o
p
r
s
t
u
v
w
y
Enumerations
a
c
d
e
h
i
j
l
m
n
o
p
r
s
t
v
y
Enumerator
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
y
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
empty.c
Go to the documentation of this file.
1
/*!
2
\file lib/manage/empty.c
3
4
\brief Manage Library - Check if element is empty
5
6
(C) 2001-2011 by the GRASS Development Team
7
8
This program is free software under the GNU General Public License
9
(>=v2). Read the file COPYING that comes with GRASS for details.
10
11
\author Original author CERL
12
*/
13
14
/* look for at least one file in the element */
15
#include <sys/types.h>
16
#include <
dirent.h
>
17
18
#include <
grass/gis.h
>
19
20
/*!
21
\brief Check if element is empty
22
23
\param elem element name
24
25
\return 1 empty
26
\return 0 not empty
27
*/
28
int
M__empty
(
char
*elem)
29
{
30
DIR
*dirp;
31
struct
dirent
*dp;
32
char
dir[
GPATH_MAX
];
33
int
any;
34
35
G_file_name
(dir, elem,
""
,
G_mapset
());
36
37
any = 0;
38
if
((dirp =
opendir
(dir)) !=
NULL
) {
39
while
(!any && (dp =
readdir
(dirp)) !=
NULL
) {
40
if
(dp->
d_name
[0] !=
'.'
)
41
any = 1;
42
}
43
closedir
(dirp);
44
}
45
46
return
any == 0;
47
}
NULL
#define NULL
Definition:
ccmath.h:32
G_file_name
char * G_file_name(char *, const char *, const char *, const char *)
Builds full path names to GIS data files.
Definition:
file_name.c:61
G_mapset
const char * G_mapset(void)
Get current mapset name.
Definition:
gis/mapset.c:33
dirent.h
DIR
struct DIR DIR
Definition:
dirent.h:18
M__empty
int M__empty(char *elem)
Check if element is empty.
Definition:
empty.c:28
gis.h
GPATH_MAX
#define GPATH_MAX
Definition:
gis.h:194
opendir
DIR * opendir(const char *name)
Definition:
msvc/dirent.c:15
closedir
int closedir(DIR *dir)
Definition:
msvc/dirent.c:54
readdir
struct dirent * readdir(DIR *dir)
Definition:
msvc/dirent.c:75
dirent
Definition:
dirent.h:20
dirent::d_name
char * d_name
Definition:
dirent.h:21
lib
manage
empty.c
Generated on Thu Mar 20 2025 07:33:24 for GRASS GIS 8 Programmer's Manual by
1.9.1