Lines Matching refs:dp
24 DIR *dp; in opendir() local
46 dp = (DIR *) malloc(sizeof(DIR)); in opendir()
47 if (dp == NULL) { in opendir()
51 dp->offset = 0; in opendir()
52 dp->finished = 0; in opendir()
54 if ((handle = FindFirstFile(filespec, &(dp->fileinfo))) == INVALID_HANDLE_VALUE) { in opendir()
57 dp->finished = 1; in opendir()
59 free(dp); in opendir()
64 dp->dir = strdup(resolved_path_buff); in opendir()
65 dp->handle = handle; in opendir()
68 return dp; in opendir()
71 struct dirent *readdir(DIR *dp) in readdir() argument
73 if (!dp || dp->finished) in readdir()
76 if (dp->offset != 0) { in readdir()
77 if (FindNextFile(dp->handle, &(dp->fileinfo)) == 0) { in readdir()
78 dp->finished = 1; in readdir()
82 dp->offset++; in readdir()
84 strlcpy(dp->dent.d_name, dp->fileinfo.cFileName, _MAX_FNAME+1); in readdir()
85 dp->dent.d_ino = 1; in readdir()
86 dp->dent.d_reclen = strlen(dp->dent.d_name); in readdir()
87 dp->dent.d_off = dp->offset; in readdir()
89 return &(dp->dent); in readdir()
92 int readdir_r(DIR *dp, struct dirent *entry, struct dirent **result) in readdir_r() argument
94 if (!dp || dp->finished) { in readdir_r()
99 if (dp->offset != 0) { in readdir_r()
100 if (FindNextFile(dp->handle, &(dp->fileinfo)) == 0) { in readdir_r()
101 dp->finished = 1; in readdir_r()
106 dp->offset++; in readdir_r()
108 strlcpy(dp->dent.d_name, dp->fileinfo.cFileName, _MAX_FNAME+1); in readdir_r()
109 dp->dent.d_ino = 1; in readdir_r()
110 dp->dent.d_reclen = strlen(dp->dent.d_name); in readdir_r()
111 dp->dent.d_off = dp->offset; in readdir_r()
113 memcpy(entry, &dp->dent, sizeof(*entry)); in readdir_r()
115 *result = &dp->dent; in readdir_r()
120 int closedir(DIR *dp) in closedir() argument
122 if (!dp) in closedir()
126 if (dp->handle != INVALID_HANDLE_VALUE) { in closedir()
127 FindClose(dp->handle); in closedir()
129 if (dp->dir) in closedir()
130 free(dp->dir); in closedir()
131 if (dp) in closedir()
132 free(dp); in closedir()
137 int rewinddir(DIR *dp) in rewinddir() argument
144 FindClose(dp->handle); in rewinddir()
146 dp->offset = 0; in rewinddir()
147 dp->finished = 0; in rewinddir()
149 filespec = (char *)malloc(strlen(dp->dir) + 2 + 1); in rewinddir()
154 strcpy(filespec, dp->dir); in rewinddir()
161 if ((handle = FindFirstFile(filespec, &(dp->fileinfo))) == INVALID_HANDLE_VALUE) { in rewinddir()
162 dp->finished = 1; in rewinddir()
165 dp->handle = handle; in rewinddir()