GRASS 8 Programmer's Manual
8.6.0dev(2026)-8843f13794
Loading...
Searching...
No Matches
isdir.c
Go to the documentation of this file.
1
/*!
2
\file lib/db/dbmi_base/isdir.c
3
4
\brief DBMI Library (base) - test for directories
5
6
SPDX-FileCopyrightText: 1999-2009, 2011 GRASS Development Team
7
SPDX-License-Identifier: GPL-2.0-or-later
8
9
\author Joel Jones (CERL/UIUC), Radim Blazek
10
\author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
11
*/
12
13
#include <
grass/config.h
>
14
#include <
grass/dbmi.h
>
15
#include <
unistd.h
>
16
#include <sys/types.h>
17
#include <
sys/stat.h
>
18
19
/*!
20
\brief Test if path is a directory
21
22
\param path pathname
23
24
\return DB_OK on success
25
\return DB_FAILED on failure
26
*/
27
int
db_isdir
(
const
char
*
path
)
28
{
29
struct
stat
x
;
30
31
if
(
stat
(
path
, &
x
) != 0)
32
return
DB_FAILED
;
33
return
(
S_ISDIR
(
x
.st_mode) ?
DB_OK
:
DB_FAILED
);
34
}
AMI_STREAM
Definition
ami_stream.h:153
AMI_STREAM::AMI_STREAM
AMI_STREAM()
Definition
ami_stream.h:227
config.h
dbmi.h
Main header of GRASS DataBase Management Interface.
DB_FAILED
#define DB_FAILED
Definition
dbmi.h:70
DB_OK
#define DB_OK
Definition
dbmi.h:69
db_isdir
int db_isdir(const char *path)
Test if path is a directory.
Definition
isdir.c:27
stat.h
S_ISDIR
#define S_ISDIR(mode)
Definition
stat.h:6
path
Definition
path.h:15
unistd.h
x
#define x
lib
db
dbmi_base
isdir.c
Generated on Tue Sep 15 2026 06:57:38 for GRASS 8 Programmer's Manual by
1.9.8