GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
dirent.c File Reference

DBMI Library (base) - directory entities management. More...

#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <grass/dbmi.h>
#include <sys/types.h>
#include <dirent.h>
Include dependency graph for dirent.c:

Go to the source code of this file.

Macros

#define R_OK   4
 
#define W_OK   2
 
#define X_OK   1
 

Typedefs

typedef struct dirent dir_entry
 

Functions

DIR * opendir ()
 
dir_entryreaddir ()
 
dbDirentdb_dirent (const char *dirname, int *n)
 Read directory and build an array of dbDirent's. More...
 
void db_free_dirent_array (dbDirent *dirent, int count)
 Free dbDirent. More...
 
dbDirentdb_alloc_dirent_array (int count)
 Allocate dirent array. More...
 

Detailed Description

DBMI Library (base) - directory entities management.

(C) 1999-2010 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Joel Jones (CERL/UIUC)
Upgraded to GRASS 5.7 by Radim Blazek

Definition in file dirent.c.

Macro Definition Documentation

◆ R_OK

#define R_OK   4

Definition at line 21 of file dirent.c.

Referenced by font_exists(), and G_has_vector_timestamp().

◆ W_OK

#define W_OK   2

Definition at line 24 of file dirent.c.

◆ X_OK

#define X_OK   1

Definition at line 27 of file dirent.c.

Typedef Documentation

◆ dir_entry

typedef struct dirent dir_entry

Definition at line 36 of file dirent.c.

Function Documentation

◆ db_alloc_dirent_array()

dbDirent* db_alloc_dirent_array ( int  count)

Allocate dirent array.

Parameters
countnumber of entities in the array
Returns
pointer to dbDirent array
NULL on failure

Definition at line 172 of file dirent.c.

References count, db_calloc(), db_init_string(), name, and NULL.

◆ db_dirent()

dbDirent* db_dirent ( const char *  dirname,
int *  n 
)

Read directory and build an array of dbDirent's.

Append one entry with name = NULL to mark end of array

Parameters
dirnamedirectory name
[out]nnumber of entities
Returns
pointer to dbDirent
NULL on error

Definition at line 57 of file dirent.c.

References count.

◆ db_free_dirent_array()

void db_free_dirent_array ( dbDirent dirent,
int  count 
)

Free dbDirent.

Parameters
direntpointer to dbDirent
countnumber of entities in the array

Definition at line 123 of file dirent.c.

References count, db_free(), db_free_string(), and name.

◆ opendir()

DIR* opendir ( )

◆ readdir()