commit 761dbbacc4f1f348797a485d7dbd73ccf56bb556
parent 25d8177f547c9ff8acf80948f309c0314e1e20a6
Author: Roberto Vargas <roberto.vargas@arm.com>
Date: Fri, 16 Nov 2018 13:18:23 +0000
[dlang] Add cd command
Change-Id: Id7c63d55dc7d5752f3e401503942000b62641f08
Diffstat:
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/dlang/dlang.c b/src/dlang/dlang.c
@@ -257,6 +257,12 @@ do_cat(const struct cmd *cmd, struct args *args)
return 0;
}
+static int
+do_chdir(const struct cmd *cmd, struct args *args)
+{
+ return chdir(args->argv[1]);
+}
+
static const struct cmd *
parse_cmd(char *buf, struct args *args)
{
@@ -399,6 +405,13 @@ static const struct cmd cmds[] = {
.helpmsg = "Print the content of an entry: cat path",
},
{
+ .name = "cd",
+ .eval = do_chdir,
+ .min = 2,
+ .max = 2,
+ .helpmsg = "change the current directory: cd path",
+ },
+ {
.name = NULL
}
};