From abf3c48e3ab46876f53108d548fcef68f229f146 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 13 Jun 2018 14:19:28 +0300 Subject: [PATCH] shared/shell: Set shell name on SHELL env This set SHELL to the first argument given. Change-Id: I51d0e2f67d7c61a6123b5100f09acb36955f9fce Signed-off-by: himanshu --- src/shared/shell.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/shared/shell.c b/src/shared/shell.c index 97d9157..e87336a 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -63,6 +63,7 @@ struct bt_shell_env { static struct { bool init; + char *name; int argc; char **argv; bool mode; @@ -978,6 +979,9 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt) index = -1; } + data.name = strdup(argv[0]); + bt_shell_set_env("SHELL", data.name); + data.argc = argc - optind; data.argv = argv + optind; optind = 0; @@ -1039,6 +1043,7 @@ void bt_shell_cleanup(void) rl_cleanup(); data.init = false; + free(data.name); } void bt_shell_quit(int status) -- 2.7.4