18 #include <sys/types.h>
25 #if !defined(HAVE_UNISTD_H)
36 static int cmp_dirent(
const void *,
const void *);
37 static int get_perm(
char *);
38 static void sort_dirent(
dbDirent *,
int);
74 len = strlen(entry->
d_name);
91 for (i = 0; i <
count; i++) {
98 sprintf(
path,
"%s/%s", dirname, entry->
d_name);
121 for (i = 0; i <
count; i++)
127 static int get_perm(
char *
path)
143 static int cmp_dirent(
const void *aa,
const void *bb)
152 static void sort_dirent(
dbDirent *a,
int n)
154 qsort(a, n,
sizeof(
dbDirent), cmp_dirent);
174 for (i = 0; i <
count; i++)
int db_isdir(const char *)
Test if path is a directory.
void * db_calloc(int, int)
Allocate memory.
void db_clear_error(void)
Clear error status.
void db_free_string(dbString *)
Free allocated space for dbString.
int db_set_string(dbString *, const char *)
Inserts string to dbString (enlarge string)
void db_free(void *)
Free allocated memory.
void db_init_string(dbString *)
Initialize dbString.
void db_syserror(const char *)
Report system error.
char * db_get_string(const dbString *)
Get string.
void * db_malloc(int)
Allocate memory.
GRASS_INTERPFL_EXPORT int count
dbDirent * db_dirent(const char *dirname, int *n)
Read directory and build an array of dbDirent's.
dbDirent * db_alloc_dirent_array(int count)
Allocate dirent array.
void db_free_dirent_array(dbDirent *db_dirent, int count)
Free dbDirent.
DIR * opendir(const char *name)
struct dirent * readdir(DIR *dir)