summaryrefslogtreecommitdiff
path: root/monitor/main.c
diff options
context:
space:
mode:
authorSonny Sasaka <sonnysasaka@chromium.org>2021-03-01 16:40:19 -0800
committerMarcel Holtmann <marcel@holtmann.org>2021-03-03 16:48:08 +0100
commitad05009dd992dee229634e033a007f002a6da4d5 (patch)
treeb30d53a6824cf3abf24fd1723d62da550b128862 /monitor/main.c
parentf6441b238c9aff5b6b3bdc3fe865ba61706eb394 (diff)
downloadbluez-ad05009dd992dee229634e033a007f002a6da4d5.tar.gz
monitor: Add option to set fallback width
Sometimes we want to be able to pipe the output of btmon to a non-terminal device. The current fallback width is usually not long enough so this patch adds an option to specify the column width. This is especially needed for text logs from bluetoothd. Reviewed-by: Daniel Winkler <danielwinkler@google.com>
Diffstat (limited to 'monitor/main.c')
-rw-r--r--monitor/main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/monitor/main.c b/monitor/main.c
index 0f5eb4a3b..969c88103 100644
--- a/monitor/main.c
+++ b/monitor/main.c
@@ -30,6 +30,7 @@
#include "analyze.h"
#include "ellisys.h"
#include "control.h"
+#include "display.h"
static void signal_callback(int signum, void *user_data)
{
@@ -67,6 +68,7 @@ static void usage(void)
"\t Read data from RTT\n"
"\t-R --rtt [<address>],[<area>],[<name>]\n"
"\t RTT control block parameters\n"
+ "\t-C, --columns [width] Output width if not a terminal\n"
"\t-h, --help Show help options\n");
}
@@ -90,6 +92,7 @@ static const struct option main_options[] = {
{ "no-pager", no_argument, NULL, 'P' },
{ "jlink", required_argument, NULL, 'J' },
{ "rtt", required_argument, NULL, 'R' },
+ { "columns", required_argument, NULL, 'C' },
{ "todo", no_argument, NULL, '#' },
{ "version", no_argument, NULL, 'v' },
{ "help", no_argument, NULL, 'h' },
@@ -121,7 +124,7 @@ int main(int argc, char *argv[])
struct sockaddr_un addr;
opt = getopt_long(argc, argv,
- "r:w:a:s:p:i:d:B:V:MNtTSAE:PJ:R:vh",
+ "r:w:a:s:p:i:d:B:V:MNtTSAE:PJ:R:C:vh",
main_options, NULL);
if (opt < 0)
break;
@@ -205,6 +208,9 @@ int main(int argc, char *argv[])
case 'R':
rtt = optarg;
break;
+ case 'C':
+ set_default_pager_num_columns(atoi(optarg));
+ break;
case '#':
packet_todo();
lmp_todo();