Signed-off-by: Hu Tao <hutao(a)cn.fujitsu.com>
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
daemon/ls.c | 24 ++++++++++++++++++++++++
generator/actions.ml | 7 +++++++
src/MAX_PROC_NR | 2 +-
3 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/daemon/ls.c b/daemon/ls.c
index d3689cd..fdacdaf 100644
--- a/daemon/ls.c
+++ b/daemon/ls.c
@@ -148,3 +148,27 @@ do_llz (const char *path)
return out; /* caller frees */
}
+
+char *
+do_ls_i (const char *dir)
+{
+ int r;
+ char *out;
+ CLEANUP_FREE char *err = NULL;
+ CLEANUP_FREE char *sdir = NULL;
+
+ sdir = sysroot_path (dir);
+ if (!sdir) {
+ reply_with_perror ("malloc");
+ return NULL;
+ }
+
+ r = command (&out, &err, str_ls, "-i", sdir, NULL);
+ if (r == -1) {
+ reply_with_error ("%s", err);
+ free (out);
+ return NULL;
+ }
+
+ return out; /* caller frees */
+}
diff --git a/generator/actions.ml b/generator/actions.ml
index bd654a3..edc4818 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -12575,6 +12575,13 @@ numbered C<partnum> on device C<device>.
It returns C<primary>, C<logical>, or C<extended>." };
+ { defaults with
+ name = "ls_i";
+ style = RString "listing", [Pathname "directory"], [];
+ proc_nr = Some 455;
+ shortdesc = "list the files in a directory with index number of each
file";
+ longdesc = "This list the files in a directory and print the index number of
each file."};
+
]
(* Non-API meta-commands available only in guestfish.
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index 515f19a..4930863 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-454
+455
--
2.1.0