monitor: Add command line option to disable pager support
diff --git a/monitor/control.c b/monitor/control.c
index ccbd873..150bdcc 100644
--- a/monitor/control.c
+++ b/monitor/control.c
@@ -1378,7 +1378,7 @@
 	return !!btsnoop_file;
 }
 
-void control_reader(const char *path)
+void control_reader(const char *path, bool pager)
 {
 	unsigned char buf[BTSNOOP_MAX_PACKET_SIZE];
 	uint16_t pktlen;
@@ -1403,7 +1403,8 @@
 		break;
 	}
 
-	open_pager();
+	if (pager)
+		open_pager();
 
 	switch (format) {
 	case BTSNOOP_FORMAT_HCI:
@@ -1437,7 +1438,8 @@
 		break;
 	}
 
-	close_pager();
+	if (pager)
+		close_pager();
 
 	btsnoop_unref(btsnoop_file);
 }
diff --git a/monitor/control.h b/monitor/control.h
index 630a852..ee28d27 100644
--- a/monitor/control.h
+++ b/monitor/control.h
@@ -25,7 +25,7 @@
 #include <stdint.h>
 
 bool control_writer(const char *path);
-void control_reader(const char *path);
+void control_reader(const char *path, bool pager);
 void control_server(const char *path);
 int control_tty(const char *path, unsigned int speed);
 int control_tracing(void);
diff --git a/monitor/main.c b/monitor/main.c
index 3e61a46..806ab7e 100644
--- a/monitor/main.c
+++ b/monitor/main.c
@@ -72,32 +72,35 @@
 		"\t-S, --sco              Dump SCO traffic\n"
 		"\t-A, --a2dp             Dump A2DP stream traffic\n"
 		"\t-E, --ellisys [ip]     Send Ellisys HCI Injection\n"
+		"\t-P, --no-pager         Disable pager usage\n"
 		"\t-h, --help             Show help options\n");
 }
 
 static const struct option main_options[] = {
-	{ "tty",     required_argument, NULL, 'd' },
+	{ "tty",       required_argument, NULL, 'd' },
 	{ "tty-speed", required_argument, NULL, 'B' },
-	{ "read",    required_argument, NULL, 'r' },
-	{ "write",   required_argument, NULL, 'w' },
-	{ "analyze", required_argument, NULL, 'a' },
-	{ "server",  required_argument, NULL, 's' },
-	{ "priority",required_argument, NULL, 'p' },
-	{ "index",   required_argument, NULL, 'i' },
-	{ "time",    no_argument,       NULL, 't' },
-	{ "date",    no_argument,       NULL, 'T' },
-	{ "sco",     no_argument,	NULL, 'S' },
-	{ "a2dp",    no_argument,	NULL, 'A' },
-	{ "ellisys", required_argument, NULL, 'E' },
-	{ "todo",    no_argument,       NULL, '#' },
-	{ "version", no_argument,       NULL, 'v' },
-	{ "help",    no_argument,       NULL, 'h' },
+	{ "read",      required_argument, NULL, 'r' },
+	{ "write",     required_argument, NULL, 'w' },
+	{ "analyze",   required_argument, NULL, 'a' },
+	{ "server",    required_argument, NULL, 's' },
+	{ "priority",  required_argument, NULL, 'p' },
+	{ "index",     required_argument, NULL, 'i' },
+	{ "time",      no_argument,       NULL, 't' },
+	{ "date",      no_argument,       NULL, 'T' },
+	{ "sco",       no_argument,       NULL, 'S' },
+	{ "a2dp",      no_argument,       NULL, 'A' },
+	{ "ellisys",   required_argument, NULL, 'E' },
+	{ "no-pager",  no_argument,       NULL, 'P' },
+	{ "todo",      no_argument,       NULL, '#' },
+	{ "version",   no_argument,       NULL, 'v' },
+	{ "help",      no_argument,       NULL, 'h' },
 	{ }
 };
 
 int main(int argc, char *argv[])
 {
 	unsigned long filter_mask = 0;
+	bool use_pager = true;
 	const char *reader_path = NULL;
 	const char *writer_path = NULL;
 	const char *analyze_path = NULL;
@@ -117,8 +120,8 @@
 		int opt;
 		struct sockaddr_un addr;
 
-		opt = getopt_long(argc, argv, "d:r:w:a:s:p:i:tTSAE:vh",
-						main_options, NULL);
+		opt = getopt_long(argc, argv, "d:r:w:a:s:p:i:tTSAEP:vh",
+							main_options, NULL);
 		if (opt < 0)
 			break;
 
@@ -182,6 +185,9 @@
 			ellisys_server = optarg;
 			ellisys_port = 24352;
 			break;
+		case 'P':
+			use_pager = false;
+			break;
 		case '#':
 			packet_todo();
 			lmp_todo();
@@ -228,7 +234,7 @@
 		if (ellisys_server)
 			ellisys_enable(ellisys_server, ellisys_port);
 
-		control_reader(reader_path);
+		control_reader(reader_path, use_pager);
 		return EXIT_SUCCESS;
 	}