Exemplo n.º 1
0
R_API char *r_cons_hud_path(const char *path, int dir) {
	char *tmp = NULL, *ret = NULL;
	RList *files;
	if (path){
		while (*path==' ')
			path++;
		tmp = (*path)? strdup(path): strdup ("./");
	} else
		tmp = strdup ("./");

	files = r_sys_dir (tmp);
	if (files) {
		ret = r_cons_hud (files, tmp);
		if (ret) {
			tmp = r_str_concat (tmp, "/");
			tmp = r_str_concat (tmp, ret);
			ret = r_file_abspath (tmp);
			free (tmp);
			tmp = ret;
			if (r_file_is_directory (tmp)) {
				ret = r_cons_hud_path (tmp, dir);
				free (tmp);
				tmp = ret;
			}
		}
		r_list_free (files);
	} else eprintf ("No files found\n");
	if (!ret) {
		free (tmp);
		return NULL;
	}
	return tmp;
}
Exemplo n.º 2
0
R_API int r_core_yank_hud_path (RCore *core, const char *input, int dir) {
	char *buf = NULL;
	ut32 len = 0;
	for (input++; *input==' '; input++) ;
	buf = r_cons_hud_path (input, dir);
	len = buf ? strlen ((const char*)buf) + 1 : 0;
	return r_core_yank_set_str (core, R_CORE_FOREIGN_ADDR, buf, len);
}