Lines Matching defs:dir
26 #include "dir.h"
29 dir_init(dir_t *dir) {
30 dir->entry.name[0] = '\0';
31 dir->entry.length = 0;
33 dir->handle = NULL;
37 dir_open(dir_t *dir, const char *dirname) {
41 if (strlen(dirname) + 3 > sizeof(dir->dirname))
43 strcpy(dir->dirname, dirname);
45 p = dir->dirname + strlen(dir->dirname);
46 if (dir->dirname < p && *(p - 1) != '/')
51 dir->handle = opendir(dirname);
52 if (dir->handle == NULL) {
80 * the dir stream and reads the first file in one operation.
83 dir_read(dir_t *dir) {
86 entry = readdir(dir->handle);
90 if (sizeof(dir->entry.name) <= strlen(entry->d_name))
93 strcpy(dir->entry.name, entry->d_name);
95 dir->entry.length = strlen(entry->d_name);
103 dir_close(dir_t *dir) {
104 (void)closedir(dir->handle);
105 dir->handle = NULL;
112 dir_reset(dir_t *dir) {
113 rewinddir(dir->handle);