30 #include <sys/types.h>
42 static int cmp_dirent(
const void *,
const void *);
43 static int get_perm(
char *);
44 static void sort_dirent(
dbDirent *,
int);
81 len = strlen(entry->d_name);
98 for (i = 0; i <
count; i++) {
105 sprintf(
path,
"%s/%s", dirname, entry->d_name);
112 sort_dirent(dirent, *n);
128 for (i = 0; i <
count; i++)
134 static int get_perm(
char *
path)
150 static int cmp_dirent(
const void *aa,
const void *bb)
159 static void sort_dirent(
dbDirent * a,
int n)
161 qsort(a, n,
sizeof(
dbDirent), cmp_dirent);
181 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.
void db_free_dirent_array(dbDirent *dirent, int count)
Free dbDirent.
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.