| 397 | |
| 398 | #if !defined(__AFL_COMPILER) && !defined(DISABLED_FOR_FRAMAC) |
| 399 | static void file_identify_dir(const char *current_dir, const unsigned int options) |
| 400 | { |
| 401 | DIR *dir; |
| 402 | struct dirent *entry; |
| 403 | dir=opendir(current_dir); |
| 404 | if(dir==NULL) |
| 405 | return; |
| 406 | while((entry=readdir(dir))!=NULL) |
| 407 | { |
| 408 | if(strcmp(entry->d_name,".")!=0 && strcmp(entry->d_name,"..")!=0) |
| 409 | { |
| 410 | struct stat buf_stat; |
| 411 | char *current_file=(char *)MALLOC(strlen(current_dir)+1+strlen(entry->d_name)+1); |
| 412 | strcpy(current_file, current_dir); |
| 413 | strcat(current_file, "/"); |
| 414 | strcat(current_file, entry->d_name); |
| 415 | #ifdef HAVE_LSTAT |
| 416 | if(lstat(current_file, &buf_stat)==0) |
| 417 | #else |
| 418 | if(stat(current_file, &buf_stat)==0) |
| 419 | #endif |
| 420 | { |
| 421 | if(S_ISDIR(buf_stat.st_mode)) |
| 422 | file_identify_dir(current_file, options); |
| 423 | else if(S_ISREG(buf_stat.st_mode)) |
| 424 | file_identify(current_file, options); |
| 425 | } |
| 426 | free(current_file); |
| 427 | } |
| 428 | } |
| 429 | closedir(dir); |
| 430 | } |
| 431 | #endif |
| 432 | |
| 433 | static void display_help(void) |
no test coverage detected