From 870696bbde31e16cdabdf433a0e529352100e905 Mon Sep 17 00:00:00 2001 From: Eduardo de la Arada Date: Wed, 24 Apr 2013 17:13:52 +0200 Subject: [PATCH] Add "show mountpoints" option to fs vmenu --- libr/core/vmenus.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/libr/core/vmenus.c b/libr/core/vmenus.c index af8cbe3239..5fb61bfeeb 100644 --- a/libr/core/vmenus.c +++ b/libr/core/vmenus.c @@ -613,6 +613,7 @@ R_API void r_core_visual_config(RCore *core) { R_API void r_core_visual_mounts (RCore *core) { RList *list; + RFSRoot *fsroot; RListIter *iter; RFSFile *file; RFSPartition *part; @@ -653,6 +654,16 @@ R_API void r_core_visual_mounts (RCore *core) { if (!n) break; r_cons_printf ("%s%s\n", (i==partition)?" > ":" ", n); } + } else if (mode == 3) { + i = 0; + r_cons_printf ("Mountpoints:\n\n"); + r_list_foreach (core->fs->roots, iter, fsroot) { + if ((option-delta <= i) && (i <= option+delta)) { + r_cons_printf ("%s %s\n", (option == i)?" > ":" ", + fsroot->path); + } + i++; + } } else { if (root) { list = r_fs_dir (core->fs, path); @@ -745,11 +756,17 @@ R_API void r_core_visual_mounts (RCore *core) { r_cons_flush (); r_cons_any_key (); } + + } else if (mode == 3) { + fsroot = r_list_get_n (core->fs->roots, option); + root = strdup (fsroot->path); + strncpy (path, root, sizeof (path)-1); + mode = 2; } dir = partition = option = 0; break; case 'k': - if (mode == 0) { + if (mode == 0 || mode == 3) { if (option > 0) option--; } else if (mode == 1) { @@ -769,6 +786,9 @@ R_API void r_core_visual_mounts (RCore *core) { } else if (mode == 1) { if (partition < r_fs_partition_get_size ()-1) partition++; + } else if (mode == 3) { + if (option < r_list_length (core->fs->roots)-1) + option++; } else { list = r_fs_dir (core->fs, path); if (dir < r_list_length (list)-1) @@ -834,6 +854,10 @@ R_API void r_core_visual_mounts (RCore *core) { *str='\0'; } break; + case 'm': + mode = 3; + option = 0; + break; case '?': r_cons_clear00 (); r_cons_printf ("\nVM: Visual Mount points help:\n\n"); @@ -842,6 +866,7 @@ R_API void r_core_visual_mounts (RCore *core) { r_cons_printf (" h/l - forward/go keys\n"); r_cons_printf (" t - choose partition type\n"); r_cons_printf (" g - dump file\n"); + r_cons_printf (" m - show mountpoints\n"); r_cons_printf (" : - enter command\n"); r_cons_printf (" ? - show this help\n"); r_cons_flush ();