** Implementation of the POSIX readdir() function using the MSVCRT. */
| 1293 | ** Implementation of the POSIX readdir() function using the MSVCRT. |
| 1294 | */ |
| 1295 | LPDIRENT readdir( |
| 1296 | LPDIR dirp |
| 1297 | ){ |
| 1298 | struct _finddata_t data; |
| 1299 | |
| 1300 | if( dirp==NULL ) return NULL; |
| 1301 | |
| 1302 | if( dirp->d_first.d_ino==0 ){ |
| 1303 | dirp->d_first.d_ino++; |
| 1304 | dirp->d_next.d_ino++; |
| 1305 | |
| 1306 | return &dirp->d_first; |
| 1307 | } |
| 1308 | |
| 1309 | next: |
| 1310 | |
| 1311 | memset(&data, 0, sizeof(struct _finddata_t)); |
| 1312 | if( _findnext(dirp->d_handle, &data)==-1 ) return NULL; |
| 1313 | |
| 1314 | /* TODO: Remove this block to allow hidden and/or system files. */ |
| 1315 | if( is_filtered(data) ) goto next; |
| 1316 | |
| 1317 | dirp->d_next.d_ino++; |
| 1318 | dirp->d_next.d_attributes = data.attrib; |
| 1319 | strncpy(dirp->d_next.d_name, data.name, NAME_MAX); |
| 1320 | dirp->d_next.d_name[NAME_MAX] = '\0'; |
| 1321 | |
| 1322 | return &dirp->d_next; |
| 1323 | } |
| 1324 | |
| 1325 | /* |
| 1326 | ** Implementation of the POSIX readdir_r() function using the MSVCRT. |
no outgoing calls
no test coverage detected