[PATCH BlueZ v2 3/3] client: Output a long message by two lines

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

 



This outputs the help message by two lines as follows if the string of
a command and a argument is long.

  set-alias <alias>          Set device alias
  select-attribute <attribute/UUID>
                             Select attribute
  attribute-info [attribute/UUID]
                             Select attribute
  read                       Read attribute value

---
 client/main.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/client/main.c b/client/main.c
index 3cb4ad5..578dde9 100644
--- a/client/main.c
+++ b/client/main.c
@@ -2262,10 +2262,18 @@ static void cmd_help(const char *arg)
 	printf("Available commands:\n");
 
 	for (i = 0; cmd_table[i].cmd; i++) {
-		printf("  %s %-*s %s\n", cmd_table[i].cmd,
+		if ((int)strlen(cmd_table[i].arg? : "") <=
+					(int)(25 - strlen(cmd_table[i].cmd)))
+			printf("  %s %-*s %s\n", cmd_table[i].cmd,
 					(int)(25 - strlen(cmd_table[i].cmd)),
 					cmd_table[i].arg ? : "",
 					cmd_table[i].desc ? : "");
+		else
+			printf("  %s %-s\n" "  %s %-25s %s\n",
+					cmd_table[i].cmd,
+					cmd_table[i].arg ? : "",
+					"", "",
+					cmd_table[i].desc ? : "");
 	}
 }
 
-- 
2.7.4

--
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