linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/4] shared/shell: Omit menu command if there are no submenus
@ 2017-12-05 18:33 Luiz Augusto von Dentz
  2017-12-05 18:33 ` [PATCH BlueZ 2/4] mesh: Make meshctl use bt_shell helpers Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2017-12-05 18:33 UTC (permalink / raw)
  To: linux-bluetooth

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

There is no need to show menu as a command if there are no submenus
to select.
---
 src/shared/shell.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/shared/shell.c b/src/shared/shell.c
index 0878cad3b..d262f534b 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -195,8 +195,11 @@ static void shell_print_menu(void)
 	}
 
 	for (entry = default_menu; entry->cmd; entry++) {
-		/* Skip menu command if not on main menu */
-		if (data.menu != data.main && !strcmp(entry->cmd, "menu"))
+		/* Skip menu command if not on main menu or if there are no
+		 * submenus.
+		 */
+		if ((data.menu != data.main && !strcmp(entry->cmd, "menu")) ||
+					queue_isempty(data.submenus))
 			continue;
 
 		/* Skip back command if on main menu */
-- 
2.13.6


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-12-06 12:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-05 18:33 [PATCH BlueZ 1/4] shared/shell: Omit menu command if there are no submenus Luiz Augusto von Dentz
2017-12-05 18:33 ` [PATCH BlueZ 2/4] mesh: Make meshctl use bt_shell helpers Luiz Augusto von Dentz
2017-12-05 18:33 ` [PATCH BlueZ 3/4] tools/obexctl: Use " Luiz Augusto von Dentz
2017-12-06  2:48   ` ERAMOTO Masaya
2017-12-06  6:51     ` Johan Hedberg
2017-12-06 12:15       ` Luiz Augusto von Dentz
2017-12-05 18:33 ` [PATCH BlueZ 4/4] tools/bluetooth-player: " Luiz Augusto von Dentz
2017-12-06  3:00   ` ERAMOTO Masaya

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).