MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / readdir

Function readdir

sqlite/src/shell.c:1212–1240  ·  view source on GitHub ↗

** Implementation of the POSIX readdir() function using the MSVCRT. */

Source from the content-addressed store, hash-verified

1210** Implementation of the POSIX readdir() function using the MSVCRT.
1211*/
1212LPDIRENT readdir(
1213 LPDIR dirp
1214){
1215 struct _finddata_t data;
1216
1217 if( dirp==NULL ) return NULL;
1218
1219 if( dirp->d_first.d_ino==0 ){
1220 dirp->d_first.d_ino++;
1221 dirp->d_next.d_ino++;
1222
1223 return &dirp->d_first;
1224 }
1225
1226next:
1227
1228 memset(&data, 0, sizeof(struct _finddata_t));
1229 if( _findnext(dirp->d_handle, &data)==-1 ) return NULL;
1230
1231 /* TODO: Remove this block to allow hidden and/or system files. */
1232 if( is_filtered(data) ) goto next;
1233
1234 dirp->d_next.d_ino++;
1235 dirp->d_next.d_attributes = data.attrib;
1236 strncpy(dirp->d_next.d_name, data.name, NAME_MAX);
1237 dirp->d_next.d_name[NAME_MAX] = '\0';
1238
1239 return &dirp->d_next;
1240}
1241
1242/*
1243** Implementation of the POSIX readdir_r() function using the MSVCRT.

Callers 11

fsdirNextFunction · 0.70
fsdirNextFunction · 0.70
empty_dirFunction · 0.50
listdir_internalFunction · 0.50
runtestdirFunction · 0.50
___os_dirlistFunction · 0.50
bb_readdirFunction · 0.50
clear_csc2_filesFunction · 0.50
clear_temp_tablesFunction · 0.50
clear_queue_extentsFunction · 0.50
initFunction · 0.50

Calls

no outgoing calls

Tested by 2

fsdirNextFunction · 0.56
runtestdirFunction · 0.40