static void text_string_notif_proc(HWND hWnd, int id, int nc, DWORD add_data) { if (nc == EN_CHANGE) { get_search_string(hWnd); HWND mdolphin_chwnd = get_current_mdolphin_hwnd(); if (!mdolphin_chwnd) return; search_for(mdolphin_chwnd); clear_mark(mdolphin_chwnd); my_mark_all_matches_for_text(mdolphin_chwnd); } }
int dir_traverse(char *loc, char *find_dir, char *buf, int process_files, int level) { DIR *dirp; struct dirent *dit; struct stat fstat; char next_loc[1024]; int found = 0; if(level > 3 && !process_files) return 0; dirp = opendir(loc); while(dirp) { if((dit = readdir(dirp)) != NULL) { if(strcmp(dit->d_name, ".") == 0 || strcmp(dit->d_name, "..") == 0) continue; snprintf(next_loc, sizeof(next_loc), "%s/%s", loc, dit->d_name); stat(next_loc, &fstat); if(S_ISDIR(fstat.st_mode)) { found = 0; if(!process_files && !strcmp(dit->d_name, find_dir)) found = 1; if(dir_traverse(next_loc, find_dir, buf, process_files | found, level + 1)) return 1; } else if(S_ISREG(fstat.st_mode) && process_files) { if(get_search_string(next_loc, buf)) return 1; } } else { break; } } closedir(dirp); return 0; }