Lines Matching defs:dir
32 #include <isc/dir.h>
40 #define VALID_DIR(dir) ISC_MAGIC_VALID(dir, ISC_DIR_MAGIC)
43 isc_dir_init(isc_dir_t *dir) {
44 REQUIRE(dir != NULL);
46 dir->entry.name[0] = '\0';
47 dir->entry.length = 0;
49 dir->handle = NULL;
51 dir->magic = ISC_DIR_MAGIC;
59 isc_dir_open(isc_dir_t *dir, const char *dirname) {
63 REQUIRE(VALID_DIR(dir));
70 if (strlen(dirname) + 3 > sizeof(dir->dirname))
73 strcpy(dir->dirname, dirname);
78 p = dir->dirname + strlen(dir->dirname);
79 if (dir->dirname < p && *(p - 1) != '/')
87 dir->handle = opendir(dirname);
89 if (dir->handle == NULL)
100 * the dir stream and reads the first file in one operation.
103 isc_dir_read(isc_dir_t *dir) {
106 REQUIRE(VALID_DIR(dir) && dir->handle != NULL);
111 entry = readdir(dir->handle);
119 if (sizeof(dir->entry.name) <= strlen(entry->d_name))
122 strcpy(dir->entry.name, entry->d_name);
127 dir->entry.length = strlen(entry->d_name);
136 isc_dir_close(isc_dir_t *dir) {
137 REQUIRE(VALID_DIR(dir) && dir->handle != NULL);
139 (void)closedir(dir->handle);
140 dir->handle = NULL;
147 isc_dir_reset(isc_dir_t *dir) {
148 REQUIRE(VALID_DIR(dir) && dir->handle != NULL);
150 rewinddir(dir->handle);