From 53b8b8df02931cdbd074a95e7943888c4b6d2187 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 26 Mar 2018 16:01:21 +0300 Subject: [PATCH] shared/shell: Add export command This adds export command to default menu which can be used to print the environment variables that have been set. --- src/shared/shell.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/shared/shell.c b/src/shared/shell.c index 367e25545..be2a8dfe0 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -198,6 +198,17 @@ static bool cmd_back_exists(const struct bt_shell_menu *menu) return true; } +static void cmd_export(int argc, char *argv[]) +{ + const struct queue_entry *entry; + + for (entry = queue_get_entries(data.envs); entry; entry = entry->next) { + struct bt_shell_env *env = entry->data; + + print_text(COLOR_HIGHLIGHT, "%s=%p", env->name, env->value); + } +} + static const struct bt_shell_menu_entry default_menu[] = { { "back", NULL, cmd_back, "Return to main menu", NULL, NULL, cmd_back_exists }, @@ -209,6 +220,8 @@ static const struct bt_shell_menu_entry default_menu[] = { { "exit", NULL, cmd_quit, "Quit program" }, { "help", NULL, cmd_help, "Display help about this program" }, + { "export", NULL, cmd_export, + "Print evironment variables" }, { } }; -- 2.47.3