[PATCH v2 1/2] shared/shell: Set shell name on SHELL env

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

This set SHELL to the first argument given.
---
 src/shared/shell.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/shared/shell.c b/src/shared/shell.c
index 97d91577e..e87336a0c 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.17.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux