From 75f73f6d62645734f9e7a2385902750cf3ad3f16 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 29 Aug 2022 14:33:04 -0700 Subject: [PATCH] shell: Set empty argument if optarg is NULL This sets enmpty string ("") when argument don't set any optarg so the application can tell when an option was set or not. --- src/shared/shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/shell.c b/src/shared/shell.c index dfda8128a..4658819a4 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -1158,7 +1158,7 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt) return; } - *opt->optarg[index - offset] = optarg; + *opt->optarg[index - offset] = optarg ? : ""; } index = -1; -- 2.47.3